OSDN Git Service

オプションファイルに誤りがあった場合はエラーを送出する。
[coroid/inqubus.git] / frontend / src / saccubus / MainFrame.java
1 package saccubus;
2
3 import java.io.IOException;
4 import saccubus.converter.Converter;
5 import java.awt.BorderLayout;
6 import java.awt.Dimension;
7 import java.awt.GridBagConstraints;
8 import java.awt.GridBagLayout;
9 import java.awt.GridLayout;
10 import java.awt.Image;
11 import java.awt.Insets;
12 import java.awt.Toolkit;
13 import java.awt.dnd.DnDConstants;
14 import java.awt.dnd.DropTarget;
15 import java.awt.event.ActionEvent;
16 import java.awt.event.ActionListener;
17 import java.awt.event.KeyEvent;
18 import java.awt.event.WindowAdapter;
19 import java.awt.event.WindowEvent;
20 import java.io.File;
21 import javax.swing.BorderFactory;
22 import javax.swing.ButtonGroup;
23 import javax.swing.JButton;
24 import javax.swing.JCheckBox;
25 import javax.swing.JComboBox;
26 import javax.swing.JFileChooser;
27 import javax.swing.JFrame;
28 import javax.swing.JLabel;
29 import javax.swing.JMenu;
30 import javax.swing.JMenuBar;
31 import javax.swing.JMenuItem;
32 import javax.swing.JOptionPane;
33 import javax.swing.JPanel;
34 import javax.swing.JPasswordField;
35 import javax.swing.JRadioButton;
36 import javax.swing.JTabbedPane;
37 import javax.swing.JTextField;
38 import javax.swing.SwingUtilities;
39 import nicobrowser.entity.NicoContent;
40 import org.apache.commons.lang.StringUtils;
41 import saccubus.ConvertStopFlag.State;
42 import saccubus.converter.profile.FfmpegOption;
43 import saccubus.converter.profile.NgSetting;
44 import saccubus.net.TextProgressListener;
45 import saccubus.properties.BasicSetting;
46 import saccubus.properties.ConvertSetting;
47 import saccubus.properties.InputCommentSetting;
48 import saccubus.properties.InputVideoSetting;
49 import saccubus.properties.SProperties;
50 import saccubus.properties.InputTcommentSetting;
51 import saccubus.properties.MovieSetting;
52 import saccubus.properties.OutputVideoSetting;
53 import saccubus.util.FileDropTarget;
54 import saccubus.util.PopupRightClick;
55 import yukihane.nicovideo.NicoDBFinder;
56
57 /**
58  * <p>
59  * \83^\83C\83g\83\8b\82³\82«\82ã\82Î\82·
60  * </p>
61  * 
62  * <p>
63  * \90à\96¾: \83j\83R\83j\83R\93®\89æ\82Ì\93®\89æ\82ð\83R\83\81\83\93\83g\82Â\82«\82Å\95Û\91
64  * </p>
65  * 
66  * <p>
67  * \92\98\8dì\8c : Copyright (c) 2007 PSI
68  * </p>
69  * 
70  * <p>
71  * \89ï\8eÐ\96¼:
72  * </p>
73  * 
74  * @author \96¢\93ü\97Í
75  * @version 1.0
76  */
77 public class MainFrame extends JFrame {
78
79     private static final long serialVersionUID = 2564486741331062989L;
80     public static final String VERSION = "1.22r NicoBrowser\8ag\92£ 1.3.1";
81     public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
82             "icon32.png"));
83     JPanel contentPane;
84     BorderLayout borderLayout1 = new BorderLayout();
85     JMenuBar jMenuBar1 = new JMenuBar();
86     JMenu jMenuFile = new JMenu();
87     JMenuItem jMenuFileExit = new JMenuItem();
88     JMenu jMenuHelp = new JMenu();
89     JMenuItem jMenuHelpAbout = new JMenuItem();
90     JLabel statusBar = new JLabel();
91     JTabbedPane MainTabbedPane = new JTabbedPane();
92     JPanel SavingInfoTabPanel = new JPanel();
93     JPanel FFMpegTabPanel = new JPanel();
94     JPanel VideoInfoPanel = new JPanel();
95     JTextField VideoID_TextField = new JTextField();
96     JButton DoButton = new JButton();
97     public static final String DoButtonDefString = "\95Ï\8a·";
98     public static final String DoButtonStopString = "\92â\8e~";
99     public static final String DoButtonWaitString = "\91Ò\8b@";
100     JPanel UserInfoPanel = new JPanel();
101     GridBagLayout gridBagLayout3 = new GridBagLayout();
102     JLabel MailAddrLabel = new JLabel();
103     JTextField MailAddrField = new JTextField();
104     JLabel PasswordLabel = new JLabel();
105     JPasswordField PasswordField = new JPasswordField();
106     GridBagLayout gridBagLayout4 = new GridBagLayout();
107     GridBagLayout gridBagLayout6 = new GridBagLayout();
108     ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
109     ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
110
111     public MainFrame() {
112         videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
113
114         try {
115             setDefaultCloseOperation(EXIT_ON_CLOSE);
116             jbInit();
117             setPopup();
118             setDropTarget();
119             SProperties setting = SProperties.loadSetting(null,
120                     null);
121             this.setSetting(setting);
122         } catch (Exception exception) {
123             exception.printStackTrace();
124         }
125     }
126
127     /**
128      * \83R\83\93\83|\81[\83l\83\93\83g\82Ì\8f\89\8aú\89»\81B
129      *
130      * @throws java.lang.Exception
131      */
132     private void jbInit() throws Exception {
133         GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
134                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
135         gridBagConstraints74.gridwidth = 2;
136         GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
137         gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
138         gridBagConstraints73.gridy = 6;
139         gridBagConstraints73.weightx = 1.0;
140         gridBagConstraints73.gridwidth = 4;
141         gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
142         gridBagConstraints73.gridx = 1;
143         GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
144         gridBagConstraints72.gridx = 0;
145         gridBagConstraints72.anchor = GridBagConstraints.WEST;
146         gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
147         gridBagConstraints72.fill = GridBagConstraints.NONE;
148         gridBagConstraints72.gridwidth = 1;
149         gridBagConstraints72.gridy = 6;
150         ShadowKindLabel = new JLabel();
151         ShadowKindLabel.setText("\89e\82Ì\8eí\97Þ");
152         ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
153         GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
154                 GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6);
155         gridBagConstraints71.fill = GridBagConstraints.BOTH;
156         gridBagConstraints71.ipady = 0;
157         GridBagConstraints gridBagConstraints70 = new GridBagConstraints();
158         gridBagConstraints70.fill = GridBagConstraints.HORIZONTAL;
159         gridBagConstraints70.gridy = 1;
160         gridBagConstraints70.ipadx = 0;
161         gridBagConstraints70.ipady = 0;
162         gridBagConstraints70.weightx = 1.0;
163         gridBagConstraints70.insets = new Insets(0, 0, 0, 0);
164         gridBagConstraints70.gridx = 1;
165         GridBagConstraints gridBagConstraints69 = new GridBagConstraints();
166         gridBagConstraints69.gridx = 0;
167         gridBagConstraints69.ipadx = 0;
168         gridBagConstraints69.ipady = 0;
169         gridBagConstraints69.insets = new Insets(0, 5, 0, 5);
170         gridBagConstraints69.anchor = GridBagConstraints.WEST;
171         gridBagConstraints69.gridy = 1;
172         GridBagConstraints gridBagConstraints68 = new GridBagConstraints();
173         gridBagConstraints68.fill = GridBagConstraints.BOTH;
174         gridBagConstraints68.gridy = 0;
175         gridBagConstraints68.ipady = 0;
176         gridBagConstraints68.weightx = 1.0;
177         gridBagConstraints68.insets = new Insets(0, 0, 0, 0);
178         gridBagConstraints68.gridx = 1;
179         GridBagConstraints gridBagConstraints67 = new GridBagConstraints();
180         gridBagConstraints67.gridx = 0;
181         gridBagConstraints67.ipadx = 0;
182         gridBagConstraints67.ipady = 0;
183         gridBagConstraints67.insets = new Insets(0, 5, 0, 5);
184         gridBagConstraints67.anchor = GridBagConstraints.WEST;
185         gridBagConstraints67.gridy = 0;
186         GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
187         gridBagConstraints66.gridx = 0;
188         gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
189         gridBagConstraints66.anchor = GridBagConstraints.WEST;
190         gridBagConstraints66.gridwidth = 2;
191         gridBagConstraints66.gridy = 1;
192         ViewCommentLabel = new JLabel();
193         ViewCommentLabel.setText("\95\\8e¦\83R\83\81\83\93\83g\90\94");
194         GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
195         gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
196         gridBagConstraints65.gridy = 1;
197         gridBagConstraints65.weightx = 1.0;
198         gridBagConstraints65.gridwidth = 6;
199         gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
200         gridBagConstraints65.gridx = 3;
201         GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
202                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
203                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
204         gridBagConstraints64.gridy = 3;
205         gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
206         gridBagConstraints64.gridx = 4;
207         GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
208                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
209                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
210         gridBagConstraints63.gridy = 7;
211         gridBagConstraints63.gridx = 0;
212         gridBagConstraints63.gridwidth = 5;
213         GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
214                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
215                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
216         gridBagConstraints62.gridy = 5;
217         gridBagConstraints62.gridx = 1;
218         gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
219         gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
220         gridBagConstraints62.gridwidth = 4;
221         GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
222                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
223                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
224         gridBagConstraints61.gridy = 5;
225         gridBagConstraints61.gridx = 0;
226         gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
227         gridBagConstraints61.anchor = GridBagConstraints.WEST;
228         gridBagConstraints61.gridwidth = 1;
229         GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
230                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
231                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
232         gridBagConstraints60.gridy = 3;
233         gridBagConstraints60.gridx = 1;
234         gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
235         gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
236         gridBagConstraints60.gridwidth = 3;
237         GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
238                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
239                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
240         gridBagConstraints59.gridy = 3;
241         gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
242         gridBagConstraints59.gridx = 0;
243         gridBagConstraints59.fill = GridBagConstraints.NONE;
244         gridBagConstraints59.anchor = GridBagConstraints.WEST;
245         gridBagConstraints59.weightx = 0.0;
246         gridBagConstraints59.gridwidth = 1;
247         GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
248         gridBagConstraints58.gridx = 0;
249         gridBagConstraints58.anchor = GridBagConstraints.WEST;
250         gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
251         gridBagConstraints58.gridwidth = 5;
252         gridBagConstraints58.weightx = 1.0;
253         gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
254         gridBagConstraints58.gridy = 0;
255         GridBagConstraints gridBagConstraints57 = new GridBagConstraints();
256         gridBagConstraints57.fill = GridBagConstraints.BOTH;
257         gridBagConstraints57.gridy = 2;
258         gridBagConstraints57.weightx = 1.0;
259         gridBagConstraints57.insets = new Insets(0, 0, 5, 5);
260         gridBagConstraints57.gridx = 1;
261         GridBagConstraints gridBagConstraints56 = new GridBagConstraints();
262         gridBagConstraints56.gridx = 0;
263         gridBagConstraints56.insets = new Insets(0, 5, 5, 5);
264         gridBagConstraints56.anchor = GridBagConstraints.WEST;
265         gridBagConstraints56.gridy = 2;
266         ExtOptionLabel = new JLabel();
267         ExtOptionLabel.setText("\8fo\97Í\93®\89æ\82Ì\8ag\92£\8eq");
268         GridBagConstraints gridBagConstraints55 = new GridBagConstraints();
269         gridBagConstraints55.gridx = 0;
270         gridBagConstraints55.fill = GridBagConstraints.HORIZONTAL;
271         gridBagConstraints55.weightx = 1.0;
272         gridBagConstraints55.gridwidth = 2;
273         gridBagConstraints55.gridy = 1;
274         GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2,
275                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
276                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
277         gridBagConstraints54.gridwidth = 3;
278         GridBagConstraints gridBagConstraints53 = new GridBagConstraints(1, 3,
279                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
280                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
281         gridBagConstraints53.gridy = 5;
282         gridBagConstraints53.gridheight = 1;
283         gridBagConstraints53.weightx = 1.0;
284         gridBagConstraints53.gridwidth = 1;
285         GridBagConstraints gridBagConstraints52 = new GridBagConstraints(2, 2,
286                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
287                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
288         gridBagConstraints52.gridy = 4;
289         gridBagConstraints52.gridwidth = 1;
290         gridBagConstraints52.weightx = 1.0;
291         gridBagConstraints52.gridx = 1;
292         GridBagConstraints gridBagConstraints51 = new GridBagConstraints(2, 1,
293                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
294                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0);
295         gridBagConstraints51.gridy = 3;
296         gridBagConstraints51.gridwidth = 1;
297         gridBagConstraints51.weightx = 1.0;
298         gridBagConstraints51.gridx = 1;
299         GridBagConstraints gridBagConstraints50 = new GridBagConstraints(0, 3,
300                 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
301                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
302         gridBagConstraints50.gridy = 5;
303         GridBagConstraints gridBagConstraints49 = new GridBagConstraints(0, 2,
304                 2, 1, 0.0, 0.0, GridBagConstraints.WEST,
305                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
306         gridBagConstraints49.gridy = 4;
307         gridBagConstraints49.gridwidth = 1;
308         GridBagConstraints gridBagConstraints48 = new GridBagConstraints(0, 1,
309                 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
310                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
311         gridBagConstraints48.gridy = 3;
312
313         GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
314         gridBagConstraints33.gridx = 0;
315         gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
316         gridBagConstraints33.weightx = 1.0;
317         gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
318         gridBagConstraints33.gridwidth = 5;
319         gridBagConstraints33.gridy = 9;
320
321         GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
322         gridBagConstraints14.gridx = 0;
323         gridBagConstraints14.anchor = GridBagConstraints.WEST;
324         gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
325         gridBagConstraints14.weightx = 1.0;
326         gridBagConstraints14.gridwidth = 5;
327         gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
328         gridBagConstraints14.gridy = 8;
329         GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
330                 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
331                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
332         gridBagConstraints7.weighty = 0.0;
333         GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
334         gridBagConstraints6.gridx = 0;
335         gridBagConstraints6.weighty = 1.0;
336         gridBagConstraints6.weightx = 1.0;
337         gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
338         gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
339         gridBagConstraints6.anchor = GridBagConstraints.NORTH;
340         gridBagConstraints6.gridy = 1;
341         GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
342                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
343                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
344         gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
345         gridBagConstraints1.anchor = GridBagConstraints.NORTH;
346         gridBagConstraints1.weighty = 1.0;
347         this.setIconImage(WinIcon);
348         contentPane = (JPanel) this.getContentPane();
349         contentPane.setLayout(borderLayout1);
350         setSize(new Dimension(400, 450));
351         setTitle("\82³\82«\82ã\82Î\82· " + VERSION);
352         this.addWindowListener(new MainFrame_this_windowAdapter(this));
353         statusBar.setText(" ");
354         jMenuFile.setText("\83t\83@\83C\83\8b");
355         jMenuFileExit.setText("\8fI\97¹");
356         jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
357                 this));
358         jMenuHelp.setText("\83w\83\8b\83v");
359         jMenuHelpAbout.setText("\83o\81[\83W\83\87\83\93\8fî\95ñ");
360         jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
361                 this));
362         VideoInfoPanel.setLayout(gridBagLayout1);
363         VideoID_TextField.setText("http://www.nicovideo.jp/watch/");
364         DoButton.setText(DoButtonDefString);
365         DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
366         SavingInfoTabPanel.setLayout(new GridLayout());
367         UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "\83\86\81[\83U\90Ý\92è"));
368         UserInfoPanel.setLayout(gridBagLayout3);
369         MailAddrLabel.setText("\83\81\81[\83\8b\83A\83h\83\8c\83X");
370         PasswordLabel.setText("\83p\83X\83\8f\81[\83h");
371
372         setListenerToSavePanelButton();
373
374         FFMpegTabPanel.setLayout(gridBagLayout6);
375         PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
376                 BorderFactory.createEtchedBorder(), "\83v\83\8d\83O\83\89\83\80\82Ì\88Ê\92u\82Ì\90Ý\92è"));
377         PathSettingPanel.setLayout(gridBagLayout7);
378         FFmpegPathLabel.setText("FFmpeg");
379         SettingFFmpegPathButton.setText("\8eQ\8fÆ");
380         SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
381                 this));
382         VhookPathLabel.setText("\8ag\92£vhook\83\89\83C\83u\83\89\83\8a");
383         SettingVhookPathButton.setText("\8eQ\8fÆ");
384         SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
385                 this));
386         VhookSettingPanel.setLayout(gridBagLayout8);
387         VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
388                 BorderFactory.createEtchedBorder(), "\8ag\92£vhook\83\89\83C\83u\83\89\83\8a\82Ì\90Ý\92è"));
389         FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
390                 BorderFactory.createEtchedBorder(), "FFmpeg\82Ì\90Ý\92è"));
391         FFmpegSettingPanel.setLayout(gridBagLayout9);
392         FontPathLabel.setText("\83t\83H\83\93\83g\83p\83X");
393         SettingFontPathButton.setText("\8eQ\8fÆ");
394         SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
395                 this));
396         ShowConvVideoCheckBox.setText("\95Ï\8a·\92\86\82Ì\89æ\91\9c\82ð\95\\8e¦\82·\82é");
397         InLabel.setText("\93ü\97Í\83I\83v\83V\83\87\83\93");
398         OutLabel.setText("\8fo\97Í\83I\83v\83V\83\87\83\93");
399         MainOptionLabel.setText("\83\81\83C\83\93\83I\83v\83V\83\87\83\93");
400         FontIndexLabel.setText("\83t\83H\83\93\83g\94Ô\8d\86");
401         VideoID_Label.setText("URL/ID");
402         WayBackLabel.setText("\89ß\8b\8e\83\8d\83O");
403         OpPanel.setLayout(new GridBagLayout());
404
405         BasicInfoTabPanel.setLayout(gridBagLayout12);
406         jMenuBar1.add(jMenuFile);
407         jMenuFile.add(jMenuFileExit);
408         jMenuBar1.add(jMenuHelp);
409         jMenuHelp.add(jMenuHelpAbout);
410         setJMenuBar(jMenuBar1);
411
412         contentPane.add(statusBar, BorderLayout.SOUTH);
413         contentPane.add(MainTabbedPane, java.awt.BorderLayout.CENTER);
414         contentPane.add(VideoInfoPanel, java.awt.BorderLayout.NORTH);
415         UserInfoPanel.add(PasswordField, new GridBagConstraints(1, 1, 1, 1,
416                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
417                 new Insets(0, 5, 5, 5), 0, 0));
418         UserInfoPanel.add(MailAddrField, new GridBagConstraints(1, 0, 1, 1,
419                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
420                 new Insets(0, 5, 5, 5), 0, 0));
421         UserInfoPanel.add(PasswordLabel, new GridBagConstraints(0, 1, 1, 1,
422                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
423                 new Insets(0, 5, 5, 0), 0, 0));
424         UserInfoPanel.add(MailAddrLabel, new GridBagConstraints(0, 0, 1, 1,
425                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
426                 new Insets(0, 5, 5, 0), 0, 0));
427         PathSettingPanel.add(FFmpegPathField, new GridBagConstraints(0, 1, 1,
428                 1, 1.0, 0.0, GridBagConstraints.CENTER,
429                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
430         PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
431         PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
432                 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
433                 new Insets(0, 5, 5, 5), 0, 0));
434         PathSettingPanel.add(VhookPathField, new GridBagConstraints(0, 3, 1, 1,
435                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
436                 new Insets(0, 5, 5, 5), 0, 0));
437         PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
438                 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
439                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
440         PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
441         FFmpegSettingPanel.add(CommandLineOutOptionField, gridBagConstraints53);
442         FFmpegSettingPanel.add(CommandLineInOptionField, gridBagConstraints52);
443         FFmpegSettingPanel.add(MainOptionField, gridBagConstraints51);
444         FFmpegSettingPanel.add(MainOptionLabel, gridBagConstraints48);
445         FFmpegSettingPanel.add(InLabel, gridBagConstraints49);
446         FFmpegSettingPanel.add(OutLabel, gridBagConstraints50);
447         FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(),
448                 gridBagConstraints55);
449         FFmpegSettingPanel.add(ExtOptionLabel, gridBagConstraints56);
450         FFmpegSettingPanel.add(getExtOptionField(), gridBagConstraints57);
451         VideoInfoPanel.add(DoButton, gridBagConstraints71);
452         VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
453                 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
454                 new Insets(0, 0, 0, 0), 0, 0));
455         OpPanel.add(VideoID_Label, gridBagConstraints67);
456         OpPanel.add(VideoID_TextField, gridBagConstraints68);
457         OpPanel.add(WayBackLabel, gridBagConstraints69);
458         OpPanel.add(WayBackField, gridBagConstraints70);
459
460         MainTabbedPane.add(BasicInfoTabPanel, "\8aî\96{\90Ý\92è");
461         MainTabbedPane.add(SavingInfoTabPanel, "\95Û\91\90Ý\92è");
462         MainTabbedPane.add(FFMpegTabPanel, "\93®\89æ\90Ý\92è");
463         MainTabbedPane.addTab("\95Ï\8a·\90Ý\92è", null, getConvertingSettingPanel(), null);
464         SavingInfoTabPanel.add(savePanel);
465         BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
466         BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
467         VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
468         VhookSettingPanel.add(ShowConvVideoCheckBox, gridBagConstraints63);
469         VhookSettingPanel.add(FontPathField, gridBagConstraints60);
470         VhookSettingPanel.add(FontIndexField, gridBagConstraints62);
471         VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
472         VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
473         VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
474         VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
475         VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
476         VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
477         VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
478         VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
479         VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
480
481         FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
482                 1.0, 0.0, GridBagConstraints.NORTHEAST,
483                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
484         FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
485     }
486
487     /**
488      * \95Û\91\90Ý\92è\83p\83l\83\8b\93à\82Ì\83{\83^\83\93\82É\83A\83N\83V\83\87\83\93\83\8a\83X\83i\82ð\8a\84\82è\93\96\82Ä\82é.
489      */
490     private void setListenerToSavePanelButton() {
491         ActionListener al;
492         al = new InputVideoPanelButtonListener();
493         videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
494         videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
495         videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
496
497         al = new VideoUseRadioButtonListener();
498         videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
499         videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
500         videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
501
502         al = new InputCommentPanelButtonListener();
503         savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
504         savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
505
506         al = new OutputVideoPanelButtonListener();
507         savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
508         savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
509     }
510
511     private void setPopup() {
512         MainOptionField.addMouseListener(new PopupRightClick(
513                 this.MainOptionField));
514         CommandLineInOptionField.addMouseListener(new PopupRightClick(
515                 this.CommandLineInOptionField));
516         CommandLineOutOptionField.addMouseListener(new PopupRightClick(
517                 this.CommandLineOutOptionField));
518         savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
519                 savePanel.getCommentNumField()));
520
521         savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
522                 savePanel.getCommentSavedFileField()));
523         savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
524                 savePanel.getCommentSavedFolderField()));
525
526         savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
527                 savePanel.getConvertedVideoSavedFileField()));
528         savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
529                 savePanel.getConvertedVideoSavedFolderField()));
530
531         videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
532                 videoSaveInfoPanel.getVideoSavedFileField()));
533         videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
534                 videoSaveInfoPanel.getVideoSavedFolderField()));
535         videoSaveInfoPanel.getNibrFileField().addMouseListener(
536                 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
537
538         FFmpegPathField.addMouseListener(new PopupRightClick(
539                 this.FFmpegPathField));
540         VhookPathField.addMouseListener(new PopupRightClick(this.VhookPathField));
541         VideoID_TextField.addMouseListener(new PopupRightClick(
542                 this.VideoID_TextField));
543         ViewCommentField.addMouseListener(new PopupRightClick(
544                 this.ViewCommentField));
545         FontPathField.addMouseListener(new PopupRightClick(this.FontPathField));
546         MailAddrField.addMouseListener(new PopupRightClick(this.MailAddrField));
547         PasswordField.addMouseListener(new PopupRightClick(this.PasswordField));
548         WayBackField.addMouseListener(new PopupRightClick(this.WayBackField));
549
550         ProxyTextField.addMouseListener(new PopupRightClick(this.ProxyTextField));
551         ProxyPortTextField.addMouseListener(new PopupRightClick(
552                 this.ProxyPortTextField));
553
554         FontIndexField.addMouseListener(new PopupRightClick(this.FontIndexField));
555
556         NGWordTextField.addMouseListener(new PopupRightClick(
557                 this.NGWordTextField));
558         NGIDTextField.addMouseListener(new PopupRightClick(this.NGIDTextField));
559     }
560
561     private void setDropTarget() {
562         addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
563         addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
564         addTarget(videoSaveInfoPanel.getNibrFileField(), false);
565
566         addTarget(savePanel.getCommentSavedFileField(), false);
567         addTarget(savePanel.getCommentSavedFolderField(), true);
568
569         addTarget(savePanel.getConvertedVideoSavedFileField(), false);
570         addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
571
572         addTarget(FFmpegPathField, false);
573         addTarget(VhookPathField, false);
574         addTarget(FontPathField, false);
575
576     }
577
578     /**
579      * \83e\83L\83X\83g\83t\83B\81[\83\8b\83h\82É\91Î\82µ\83h\83\8d\83b\83v\82ð\8ds\82Á\82½\8fê\8d\87\82É\83t\83@\83C\83\8b\82à\82µ\82­\82Í\83f\83B\83\8c\83N\83g\83\8a\82Ì\95\8e\9a\97ñ\82ð\90Ý\92è\82Å\82«\82é\82æ\82¤\82É\82·\82é.
580      * @param c \90Ý\92è\91Î\8fÛ\82Ì\83e\83L\83X\83g\83t\83B\81[\83\8b\83h\83I\83u\83W\83F\83N\83g.
581      * @param isDir \83f\83B\83\8c\83N\83g\83\8a\82ð\90Ý\92è\82·\82é\8fê\8d\87\82Ítrue, \83t\83@\83C\83\8b\82Ì\8fê\8d\87\82Ífalse.
582      * @return \83h\83\8d\83b\83v\83^\81[\83Q\83b\83g(\97p\93r\96³\82µ).
583      */
584     private DropTarget addTarget(JTextField c, boolean isDir) {
585         return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
586                 c, isDir), true);
587     }
588     private File CurrentDir = new File(".");
589     JPanel PathSettingPanel = new JPanel();
590     JLabel FFmpegPathLabel = new JLabel();
591     GridBagLayout gridBagLayout7 = new GridBagLayout();
592     JTextField FFmpegPathField = new JTextField();
593     JButton SettingFFmpegPathButton = new JButton();
594     JLabel VhookPathLabel = new JLabel();
595     JTextField VhookPathField = new JTextField();
596     JButton SettingVhookPathButton = new JButton();
597     JPanel VhookSettingPanel = new JPanel();
598     GridBagLayout gridBagLayout8 = new GridBagLayout();
599     JPanel FFmpegSettingPanel = new JPanel();
600     GridBagLayout gridBagLayout9 = new GridBagLayout();
601     JLabel FontPathLabel = new JLabel();
602     JTextField FontPathField = new JTextField();
603     JButton SettingFontPathButton = new JButton();
604     JCheckBox ShowConvVideoCheckBox = new JCheckBox();
605     JTextField CommandLineOutOptionField = new JTextField();
606
607     private void showSaveDialog(String title, JTextField field, boolean isSave,
608             boolean isDir) {
609         JFileChooser chooser = new JFileChooser(CurrentDir);
610         chooser.setDialogTitle(title);
611         int code = 0;
612         if (isDir) {
613             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
614         }
615         if (isSave) {
616             code = chooser.showSaveDialog(this);
617         } else {
618             code = chooser.showOpenDialog(this);
619         }
620         if (code == JFileChooser.APPROVE_OPTION) {
621             if (isDir) {
622                 CurrentDir = chooser.getCurrentDirectory();
623                 field.setText(CurrentDir.getAbsolutePath());
624             } else {
625                 File selected = chooser.getSelectedFile();
626                 CurrentDir = chooser.getCurrentDirectory();
627                 field.setText(selected.getAbsolutePath());
628             }
629         }
630     }
631
632     private SProperties getSetting() {
633         SProperties setting = new SProperties(
634                 getBasicSetting(),
635                 getInputVideoSetting(),
636                 getInputCommentSetting(),
637                 getTcommentSetting(),
638                 getOutputVideoSetting(),
639                 getMovieSetting(),
640                 getConvertSetting());
641         return setting;
642     }
643
644     /**
645      * \90Ý\92è\82ð\89æ\96Ê\82É\94½\89f\82·\82é.
646      * @param setting \94½\89f\82·\82é\90Ý\92è.
647      */
648     private void setSetting(SProperties setting) {
649         // \8aî\96{\90Ý\92è
650         final BasicSetting basic = setting.getBasicSetting();
651         MailAddrField.setText(basic.getUser().getMail());
652         PasswordField.setText(basic.getUser().getPassword());
653         // \83v\83\8d\83L\83V\8aÖ\98A
654         UseProxyCheckBox.setSelected(basic.isProxyUse());
655         ProxyTextField.setText(basic.getProxyHost());
656         int proxy_port = basic.getProxyPort();
657         if (proxy_port >= 0 && proxy_port <= 65535) {
658             ProxyPortTextField.setText(Integer.toString(proxy_port));
659         } else {
660             ProxyPortTextField.setText("");
661         }
662
663         // \95Û\91\90Ý\92è - \93ü\97Í\93®\89æ
664         final InputVideoSetting inVideo = setting.getInputVideoSetting();
665         JRadioButton activeButton;
666         switch (inVideo.getProcessKind()) {
667             case NO_SAVE:
668                 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
669                 break;
670             case NICOBROWSER:
671                 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
672                 break;
673             case SAVE:
674             default:
675                 activeButton = videoSaveInfoPanel.getVideoSaveButton();
676                 break;
677         }
678         activeButton.doClick();
679
680         videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
681         videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
682         videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
683         final boolean videoFixName = inVideo.isAutoNaming();
684         videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
685         videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
686         videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
687
688         // \95Û\91\90Ý\92è - \93ü\97Í\83R\83\81\83\93\83g
689         final InputCommentSetting inputComment = setting.getInputCommentSetting();
690         savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
691         savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
692         savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
693         savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
694         savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
695         savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
696         boolean commentFixName = inputComment.isAutoNaming();
697         savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
698         savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
699
700         // \93\8a\8de\8eÒ\83R\83\81\83\93\83g
701         InputTcommentSetting tcom = setting.getInputTcommentSetting();
702         savePanel.setTcommentDownload(tcom.getProcessKind());
703         savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
704         savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
705         savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
706         savePanel.setTcommentFileName(tcom.getFile().getPath());
707
708         // \95Û\91\90Ý\92è - \8fo\97Í\83R\83\81\83\93\83g\95t\82«\93®\89æ
709         final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
710         savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
711         savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
712         savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
713         savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
714         savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
715         savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
716         boolean convFixName = outputVideo.isAutoNaming();
717         savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
718         savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
719
720         // \93®\89æ\90Ý\92è
721         final MovieSetting movie = setting.getMovieSetting();
722         FFmpegPathField.setText(movie.getFfmpeg().toString());
723         VhookPathField.setText(movie.getVhook().toString());
724         ExtOptionField.setText(movie.getFfmpegOption().getExtOption());
725         MainOptionField.setText(movie.getFfmpegOption().getMainOption());
726         CommandLineOutOptionField.setText(movie.getFfmpegOption().getOutOption());
727         CommandLineInOptionField.setText(movie.getFfmpegOption().getInOption());
728         FFmpegOptionModel.reload(movie.getOptionFile());
729
730         // \95Ï\8a·\90Ý\92è
731         final ConvertSetting conv = setting.getConvertSetting();
732         NotUseVhookCheckBox.setSelected(conv.isVhookDisabled());
733         ViewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
734         FontPathField.setText(conv.getFont().toString());
735         FontIndexField.setText(Integer.toString(conv.getFontIndex()));
736         ShadowComboBox.setSelectedIndex(conv.getShadowIndex());
737         ShowConvVideoCheckBox.setSelected(conv.isShowConverting());
738         FixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
739         OpaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
740         NGWordTextField.setText(conv.getNgSetting().getWord());
741         NGIDTextField.setText(conv.getNgSetting().getId());
742     }
743
744     /**
745      * [\83t\83@\83C\83\8b|\8fI\97¹] \83A\83N\83V\83\87\83\93\82ª\8eÀ\8ds\82³\82ê\82Ü\82µ\82½\81B
746      *
747      * @param actionEvent
748      *            ActionEvent
749      */
750     void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
751         SProperties setting = getSetting();
752         SProperties.saveSetting(setting);
753         System.exit(0);
754     }
755
756     /**
757      * [\83w\83\8b\83v|\83o\81[\83W\83\87\83\93\8fî\95ñ] \83A\83N\83V\83\87\83\93\82ª\8eÀ\8ds\82³\82ê\82Ü\82µ\82½\81B
758      *
759      * @param actionEvent
760      *            ActionEvent
761      */
762     void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
763         MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
764         dlg.pack();
765         dlg.setLocationRelativeTo(this);
766         dlg.setVisible(true);
767     }
768
769     /* \95Ï\8a·\81E\95Û\91\82·\82é */
770     Converter Converter = null;
771     JTextField CommandLineInOptionField = new JTextField();
772     JLabel InLabel = new JLabel();
773     JLabel OutLabel = new JLabel();
774     JLabel MainOptionLabel = new JLabel();
775     JTextField MainOptionField = new JTextField();
776     JLabel FontIndexLabel = new JLabel();
777     JTextField FontIndexField = new JTextField();
778     JLabel VideoID_Label = new JLabel();
779     JLabel WayBackLabel = new JLabel();
780     JTextField WayBackField = new JTextField();
781     GridBagLayout gridBagLayout10 = new GridBagLayout();
782     GridBagLayout gridBagLayout11 = new GridBagLayout();
783     GridBagLayout gridBagLayout1 = new GridBagLayout();
784     JPanel OpPanel = new JPanel();
785     GridLayout gridLayout1 = new GridLayout();
786     JPanel BasicInfoTabPanel = new JPanel();
787     GridBagLayout gridBagLayout12 = new GridBagLayout();
788     private JPanel ConvertingSettingPanel = null;
789     private JPanel NGWordSettingPanel = null;
790     private JLabel NGWordLavel = null;
791     private JTextField NGWordTextField = null;
792     private JLabel NGIDLabel = null;
793     private JTextField NGIDTextField = null;
794     private JPanel ProxyInfoPanel = null;
795     private JLabel ProxyLabel = null;
796     private JTextField ProxyTextField = null;
797     private JLabel ProxyPortLabel = null;
798     private JTextField ProxyPortTextField = null;
799     private JCheckBox UseProxyCheckBox = null;
800     private JCheckBox FixFontSizeCheckBox = null;
801     private JCheckBox OpaqueCommentCheckBox = null;
802     private final SavePanel savePanel = new SavePanel();
803     private final VideoSaveInfoPanel videoSaveInfoPanel;
804     private JComboBox FFmpegOptionComboBox = null;
805     private JButton FFmpegOptionReloadButton = null;
806     private JPanel FFmpegOptionComboBoxPanel = null;
807
808     public void DoButton_actionPerformed(ActionEvent e) {
809         if (Converter == null || Converter.isConverted()) {
810             try {
811                 executeConvert();
812             } catch (Exception ex) {
813                 String text = ex.getMessage();
814                 if (StringUtils.isEmpty(text)) {
815                     text = "\97\\8aú\82µ\82È\82¢\83G\83\89\81[\82Ì\82½\82ß\92\86\92f\82µ\82Ü\82µ\82½\81B";
816                 }
817                 statusBar.setText(text);
818             }
819         } else { /* \8aJ\8en\82µ\82Ä\82¢\82é\82Ì\82Å\81A\83X\83g\83b\83v\82·\82é\81B */
820             final ConvertStopFlag flag = Converter.getStopFlag();
821             if (!flag.needStop()) { /* \82Ü\82¾\83X\83g\83b\83v\82µ\82Ä\82¢\82È\82¢\81B */
822                 flag.requestStop();
823             }
824         }
825     }
826
827     private void executeConvert() throws IOException {
828         String url;
829
830         // NicoBrowser\83t\83@\83C\83\8b\82ð\97\98\97p\82·\82é\8fê\8d\87\82Í\81A\83t\83@\83C\83\8b\96¼\82©\82ç\83r\83f\83IID\82ð\93Á\92è.
831         if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
832             try {
833                 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
834                 NicoDBFinder finder = NicoDBFinder.getInstance();
835                 NicoContent info = finder.findNicoContent(fileName);
836                 if (info != null) {
837                     url = info.getNicoId();
838                 } else {
839                     url = "";
840                 }
841             } catch (Exception ex) {
842                 JOptionPane.showMessageDialog(this, ex.getMessage(), "\83G\83\89\81[", JOptionPane.ERROR_MESSAGE);
843                 return;
844             }
845         } else {
846             url = VideoID_TextField.getText();
847         }
848
849         TextProgressListener sl = new TextProgressListener() {
850
851             public void setText(final String text) {
852                 SwingUtilities.invokeLater(new Runnable() {
853
854                     public void run() {
855                         statusBar.setText(text);
856                     }
857                 });
858             }
859         };
860
861         ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
862
863             public void changeState(final State s) {
864                 SwingUtilities.invokeLater(new Runnable() {
865
866                     public void run() {
867                         switch (s) {
868                             case PROCESSING:
869                                 DoButton.setText(DoButtonStopString);
870                                 break;
871                             case STOPPING:
872                                 DoButton.setText(DoButtonWaitString);
873                                 break;
874                             case FINISHED:
875                                 DoButton.setText(DoButtonDefString);
876                         }
877                     }
878                 });
879             }
880         };
881
882         Converter = new Converter(url, WayBackField.getText(), getSetting().toProfile(), sl,
883                 new ConvertStopFlag(scl));
884         new Thread(Converter).start();
885
886     }
887
888     /* FFmpeg\82Ö\82Ì\83p\83X */
889     public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
890         showSaveDialog("FFmpeg\82Ö\82Ì\83p\83X", FFmpegPathField, false, false);
891     }
892
893     public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
894         showSaveDialog("\8ag\92£vhook\83\89\83C\83u\83\89\83\8a\82Ö\82Ì\83p\83X", VhookPathField, false, false);
895     }
896
897     public void SettingFontPathButton_actionPerformed(ActionEvent e) {
898         showSaveDialog("\83t\83H\83\93\83g\82Ö\82Ì\83p\83X", FontPathField, false, false);
899     }
900
901     public void this_windowClosing(WindowEvent e) {
902         this.jMenuFileExit_actionPerformed(null);
903     }
904
905     /**
906      * This method initializes ConvertingSettingPanel
907      *
908      * @return javax.swing.JPanel
909      */
910     private JPanel getConvertingSettingPanel() {
911         if (ConvertingSettingPanel == null) {
912             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
913             gridBagConstraints11.weighty = 1.0;
914             gridBagConstraints11.weightx = 1.0;
915             gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
916             gridBagConstraints11.gridy = 1;
917             gridBagConstraints11.gridx = 0;
918             gridBagConstraints11.anchor = GridBagConstraints.NORTH;
919             gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
920             GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
921                     2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
922                     GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
923             gridBagConstraints.gridx = 0;
924             gridBagConstraints.anchor = GridBagConstraints.CENTER;
925             gridBagConstraints.weighty = 0.0;
926             gridBagConstraints.gridy = 0;
927             ConvertingSettingPanel = new JPanel();
928             ConvertingSettingPanel.setLayout(new GridBagLayout());
929             ConvertingSettingPanel.add(getNGWordSettingPanel(),
930                     gridBagConstraints11);
931             ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
932         }
933         return ConvertingSettingPanel;
934     }
935
936     /**
937      * This method initializes NGWordSettingPanel
938      *
939      * @return javax.swing.JPanel
940      */
941     private JPanel getNGWordSettingPanel() {
942         if (NGWordSettingPanel == null) {
943             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
944             gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
945             gridBagConstraints5.gridy = 1;
946             gridBagConstraints5.weightx = 1.0;
947             gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
948             gridBagConstraints5.gridx = 1;
949             GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
950             gridBagConstraints4.gridx = 0;
951             gridBagConstraints4.anchor = GridBagConstraints.WEST;
952             gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
953             gridBagConstraints4.gridy = 1;
954             NGIDLabel = new JLabel();
955             NGIDLabel.setText("NG ID");
956             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
957             gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
958             gridBagConstraints3.gridy = 0;
959             gridBagConstraints3.weightx = 1.0;
960             gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
961             gridBagConstraints3.gridx = 1;
962             GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
963             gridBagConstraints2.gridx = 0;
964             gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
965             gridBagConstraints2.gridy = 0;
966             NGWordLavel = new JLabel();
967             NGWordLavel.setText("NG\83\8f\81[\83h");
968             NGWordSettingPanel = new JPanel();
969             NGWordSettingPanel.setLayout(new GridBagLayout());
970             NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
971                     "NG\83\8f\81[\83h\81EID\90Ý\92è"));
972             NGWordSettingPanel.add(NGWordLavel, gridBagConstraints2);
973             NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
974             NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
975             NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
976         }
977         return NGWordSettingPanel;
978     }
979
980     /**
981      * This method initializes NGWordTextField
982      *
983      * @return javax.swing.JTextField
984      */
985     private JTextField getNGWordTextField() {
986         if (NGWordTextField == null) {
987             NGWordTextField = new JTextField();
988         }
989         return NGWordTextField;
990     }
991
992     /**
993      * This method initializes NGIDTextField
994      *
995      * @return javax.swing.JTextField
996      */
997     private JTextField getNGIDTextField() {
998         if (NGIDTextField == null) {
999             NGIDTextField = new JTextField();
1000         }
1001         return NGIDTextField;
1002     }
1003
1004     /**
1005      * This method initializes ProxyInfoPanel
1006      *
1007      * @return javax.swing.JPanel
1008      */
1009     private JPanel getProxyInfoPanel() {
1010         if (ProxyInfoPanel == null) {
1011             GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1012             gridBagConstraints13.gridx = 0;
1013             gridBagConstraints13.gridwidth = 2;
1014             gridBagConstraints13.weightx = 1.0;
1015             gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1016             gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1017             gridBagConstraints13.gridy = 0;
1018             GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1019             gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1020             gridBagConstraints12.gridy = 2;
1021             gridBagConstraints12.weightx = 1.0;
1022             gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1023             gridBagConstraints12.gridx = 1;
1024             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1025             gridBagConstraints10.gridx = 0;
1026             gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1027             gridBagConstraints10.gridy = 2;
1028             ProxyPortLabel = new JLabel();
1029             ProxyPortLabel.setText("\83|\81[\83g\94Ô\8d\86");
1030             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1031             gridBagConstraints9.fill = GridBagConstraints.BOTH;
1032             gridBagConstraints9.gridy = 1;
1033             gridBagConstraints9.weightx = 1.0;
1034             gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1035             gridBagConstraints9.gridx = 1;
1036             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1037             gridBagConstraints8.gridx = 0;
1038             gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1039             gridBagConstraints8.fill = GridBagConstraints.NONE;
1040             gridBagConstraints8.anchor = GridBagConstraints.EAST;
1041             gridBagConstraints8.gridy = 1;
1042             ProxyLabel = new JLabel();
1043             ProxyLabel.setText("\83v\83\8d\83L\83V");
1044             ProxyInfoPanel = new JPanel();
1045             ProxyInfoPanel.setLayout(new GridBagLayout());
1046             ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1047                     "\83v\83\8d\83L\83V\90Ý\92è"));
1048             ProxyInfoPanel.add(ProxyLabel, gridBagConstraints8);
1049             ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1050             ProxyInfoPanel.add(ProxyPortLabel, gridBagConstraints10);
1051             ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1052             ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1053         }
1054         return ProxyInfoPanel;
1055     }
1056
1057     /**
1058      * This method initializes ProxyTextField
1059      *
1060      * @return javax.swing.JTextField
1061      */
1062     private JTextField getProxyTextField() {
1063         if (ProxyTextField == null) {
1064             ProxyTextField = new JTextField();
1065         }
1066         return ProxyTextField;
1067     }
1068
1069     /**
1070      * This method initializes ProxyPortTextField
1071      *
1072      * @return javax.swing.JTextField
1073      */
1074     private JTextField getProxyPortTextField() {
1075         if (ProxyPortTextField == null) {
1076             ProxyPortTextField = new JTextField();
1077         }
1078         return ProxyPortTextField;
1079     }
1080
1081     /**
1082      * This method initializes UseProxyCheckBox
1083      *
1084      * @return javax.swing.JCheckBox
1085      */
1086     private JCheckBox getUseProxyCheckBox() {
1087         if (UseProxyCheckBox == null) {
1088             UseProxyCheckBox = new JCheckBox();
1089             UseProxyCheckBox.setText("\83v\83\8d\83L\83V\82ð\8eg\82¤");
1090         }
1091         return UseProxyCheckBox;
1092     }
1093
1094     /**
1095      * This method initializes FixFontSizeCheckBox
1096      *
1097      * @return javax.swing.JCheckBox
1098      */
1099     private JCheckBox getFixFontSizeCheckBox() {
1100         if (FixFontSizeCheckBox == null) {
1101             FixFontSizeCheckBox = new JCheckBox();
1102             FixFontSizeCheckBox.setText("\83t\83H\83\93\83g\83T\83C\83Y\82ð\89æ\96Ê\82É\82 \82í\82¹\82Ä\8e©\93®\92²\90®\82·\82é");
1103         }
1104         return FixFontSizeCheckBox;
1105     }
1106
1107     /**
1108      * This method initializes OpaqueCommentCheckBox
1109      *
1110      * @return javax.swing.JCheckBox
1111      */
1112     private JCheckBox getOpaqueCommentCheckBox() {
1113         if (OpaqueCommentCheckBox == null) {
1114             OpaqueCommentCheckBox = new JCheckBox();
1115             OpaqueCommentCheckBox.setText("\91S\82Ä\82Ì\83R\83\81\83\93\83g\82ð\95s\93§\96¾\82É\82·\82é");
1116         }
1117         return OpaqueCommentCheckBox;
1118     }
1119     /**
1120      * This method initializes FFmpegOptionComboBox
1121      *
1122      * @return javax.swing.JComboBox
1123      */
1124     private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1125     private JLabel ExtOptionLabel = null;
1126     private JTextField ExtOptionField = null;
1127     private JCheckBox NotUseVhookCheckBox = null;
1128     private JTextField ViewCommentField = null;
1129     private JLabel ViewCommentLabel = null;
1130     private JLabel ShadowKindLabel = null;
1131     private JComboBox ShadowComboBox = null;
1132
1133     private JComboBox getFFmpegOptionComboBox() {
1134         if (FFmpegOptionComboBox == null) {
1135             FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1136             FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1137
1138                 public void actionPerformed(java.awt.event.ActionEvent e) {
1139                     if (FFmpegOptionModel.isFile()) {// \83t\83@\83C\83\8b
1140                         ExtOptionField.setEnabled(false);
1141                         MainOptionField.setEnabled(false);
1142                         CommandLineInOptionField.setEnabled(false);
1143                         CommandLineOutOptionField.setEnabled(false);
1144                     } else {// \83t\83@\83C\83\8b\82Å\82È\82¢
1145                         ExtOptionField.setEnabled(true);
1146                         MainOptionField.setEnabled(true);
1147                         CommandLineInOptionField.setEnabled(true);
1148                         CommandLineOutOptionField.setEnabled(true);
1149                     }
1150                 }
1151             });
1152         }
1153         return FFmpegOptionComboBox;
1154     }
1155
1156     /**
1157      * This method initializes FFmpegOptionReloadButton
1158      *
1159      * @return javax.swing.JButton
1160      */
1161     private JButton getFFmpegOptionReloadButton() {
1162         if (FFmpegOptionReloadButton == null) {
1163             FFmpegOptionReloadButton = new JButton();
1164             FFmpegOptionReloadButton.setText("\8dX\90V");
1165             FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1166
1167                 public void actionPerformed(java.awt.event.ActionEvent e) {
1168                     FFmpegOptionModel.reload();
1169                 }
1170             });
1171         }
1172         return FFmpegOptionReloadButton;
1173     }
1174
1175     /**
1176      * This method initializes FFmpegOptionComboBoxPanel
1177      *
1178      * @return javax.swing.JPanel
1179      */
1180     private JPanel getFFmpegOptionComboBoxPanel() {
1181         if (FFmpegOptionComboBoxPanel == null) {
1182             GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1183             gridBagConstraints47.fill = GridBagConstraints.BOTH;
1184             gridBagConstraints47.gridx = -1;
1185             gridBagConstraints47.gridy = -1;
1186             gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1187             GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1188             gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1189             gridBagConstraints46.gridwidth = 3;
1190             gridBagConstraints46.gridx = -1;
1191             gridBagConstraints46.gridy = -1;
1192             gridBagConstraints46.weightx = 1.0;
1193             gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1194             FFmpegOptionComboBoxPanel = new JPanel();
1195             FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1196             FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1197                     gridBagConstraints46);
1198             FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1199                     gridBagConstraints47);
1200         }
1201         return FFmpegOptionComboBoxPanel;
1202     }
1203
1204     /**
1205      * This method initializes ExtOptionField
1206      *
1207      * @return javax.swing.JTextField
1208      */
1209     private JTextField getExtOptionField() {
1210         if (ExtOptionField == null) {
1211             ExtOptionField = new JTextField();
1212         }
1213         return ExtOptionField;
1214     }
1215
1216     /**
1217      * This method initializes NotUseVhookCheckBox
1218      *
1219      * @return javax.swing.JCheckBox
1220      */
1221     private JCheckBox getNotUseVhookCheckBox() {
1222         if (NotUseVhookCheckBox == null) {
1223             NotUseVhookCheckBox = new JCheckBox();
1224             NotUseVhookCheckBox.setText("\8ag\92£vhook\83\89\83C\83u\83\89\83\8a\82ð\96³\8cø\82É\82·\82é\81i\83f\83o\83b\83O\97p\81j");
1225         }
1226         return NotUseVhookCheckBox;
1227     }
1228
1229     /**
1230      * This method initializes ViewCommentField
1231      *
1232      * @return javax.swing.JTextField
1233      */
1234     private JTextField getViewCommentField() {
1235         if (ViewCommentField == null) {
1236             ViewCommentField = new JTextField();
1237         }
1238         return ViewCommentField;
1239     }
1240
1241     /**
1242      * This method initializes ShadowComboBox
1243      *
1244      * @return javax.swing.JComboBox
1245      */
1246     private JComboBox getShadowComboBox() {
1247         if (ShadowComboBox == null) {
1248             ShadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1249         }
1250         return ShadowComboBox;
1251     }
1252
1253     private BasicSetting getBasicSetting() {
1254         String mail = MailAddrField.getText();
1255         String pass = String.valueOf(PasswordField.getPassword());
1256         boolean proxyUse = UseProxyCheckBox.isSelected();
1257         String proxyHost = ProxyTextField.getText();
1258         int proxyPort;
1259         try {
1260             proxyPort = Integer.parseInt(ProxyPortTextField.getText());
1261         } catch (NumberFormatException e) {
1262             proxyPort = -1;
1263         }
1264         return new BasicSetting(mail, pass, proxyUse, proxyHost, proxyPort);
1265     }
1266
1267     private InputVideoSetting getInputVideoSetting() {
1268         VideoSaveKind kind;
1269         if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1270             kind = VideoSaveKind.NO_SAVE;
1271         } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1272             kind = VideoSaveKind.NICOBROWSER;
1273         } else {
1274             kind = VideoSaveKind.SAVE;
1275         }
1276         boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1277         String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1278         String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1279         boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1280         String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1281
1282         return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1283     }
1284
1285     private InputCommentSetting getInputCommentSetting() {
1286         boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1287         String file = savePanel.getCommentSavedFileField().getText();
1288         int back_comment;
1289         try {
1290             back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1291         } catch (NumberFormatException ex) {
1292             back_comment = 500;
1293         }
1294         boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1295         boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1296         String folder = savePanel.getCommentSavedFolderField().getText();
1297         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1298
1299         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1300                 back_comment);
1301     }
1302
1303     /**
1304      * \89æ\96Ê\93ü\97Í\92l\82©\82ç\93\8a\8de\8eÒ\83R\83\81\83\93\83g\90Ý\92è\82ð\8dì\90¬\82·\82é.
1305      * @return \8dì\90¬\82µ\82½\93\8a\8de\8eÒ\83R\83\81\83\93\83g\90Ý\92è.
1306      */
1307     private InputTcommentSetting getTcommentSetting() {
1308         boolean down = savePanel.isTcommentDownload();
1309         boolean del = savePanel.isTcommentDelete();
1310         boolean naming = savePanel.isTcommentAutoFileName();
1311         String dir = savePanel.getTcommentDirectoryName();
1312         String f = savePanel.getTcommentFileName();
1313         return new InputTcommentSetting(down, naming, dir, f, del);
1314     }
1315
1316     private OutputVideoSetting getOutputVideoSetting() {
1317         boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1318         boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1319         boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1320         String file = savePanel.getConvertedVideoSavedFileField().getText();
1321         boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1322         boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1323         String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1324
1325         return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1326                 addTcomment);
1327     }
1328
1329     private MovieSetting getMovieSetting() {
1330         String ffmpeg = FFmpegPathField.getText();
1331         String vhook = VhookPathField.getText();
1332         String ext = ExtOptionField.getText();
1333         String main = MainOptionField.getText();
1334         String in = CommandLineInOptionField.getText();
1335         String out = CommandLineOutOptionField.getText();
1336         File optionFile = FFmpegOptionModel.getSelectedFile();
1337
1338         FfmpegOption opt = new FfmpegOption(ext, main, in, out);
1339         return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1340     }
1341
1342     private ConvertSetting getConvertSetting() {
1343         boolean vhookDisabled = NotUseVhookCheckBox.isSelected();
1344         int maxComment = 30;
1345         try {
1346             maxComment = Integer.parseInt(ViewCommentField.getText());
1347         } catch (NumberFormatException ex) {
1348         }
1349         File font = new File(FontPathField.getText());
1350         int fontIndex = Integer.parseInt(FontIndexField.getText());
1351         int shadowIndex = ShadowComboBox.getSelectedIndex();
1352         boolean showConv = ShowConvVideoCheckBox.isSelected();
1353         boolean adjustFont = FixFontSizeCheckBox.isSelected();
1354         boolean commentOpaque = OpaqueCommentCheckBox.isSelected();
1355         NgSetting ngSetting = new NgSetting(NGWordTextField.getText(), NGIDTextField.getText());
1356
1357         return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1358                 commentOpaque, ngSetting);
1359     }
1360
1361     private class InputVideoPanelButtonListener implements ActionListener {
1362
1363         public void actionPerformed(ActionEvent e) {
1364             final Object source = e.getSource();
1365             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1366             String title;
1367             JTextField field;
1368             boolean isSave;
1369             boolean isDir;
1370
1371             if (source == panel.getShowSavingVideoFolderDialogButton()) {
1372                 title = "\93®\89æ\82Ì\95Û\91\90æ(\83t\83H\83\8b\83_)";
1373                 field = panel.getVideoSavedFolderField();
1374                 isSave = true;
1375                 isDir = true;
1376             } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1377                 title = "\93®\89æ\82Ì\95Û\91\90æ(\83t\83@\83C\83\8b)";
1378                 field = panel.getVideoSavedFileField();
1379                 isSave = true;
1380                 isDir = false;
1381             } else if (source == panel.getNibrFileChooserButton()) {
1382                 title = "NicoBrowser\83t\83@\83C\83\8b\91I\91ð";
1383                 field = panel.getNibrFileField();
1384                 isSave = false;
1385                 isDir = false;
1386             } else {
1387                 return;
1388             }
1389             showSaveDialog(title, field, isSave, isDir);
1390         }
1391     }
1392
1393     private class InputCommentPanelButtonListener implements ActionListener {
1394
1395         public void actionPerformed(ActionEvent e) {
1396             final Object source = e.getSource();
1397             String title;
1398             JTextField field;
1399             boolean isSave;
1400             boolean isDir;
1401             if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1402                 title = "\83R\83\81\83\93\83g\82Ì\95Û\91\90æ(\83t\83H\83\8b\83_)";
1403                 field = savePanel.getCommentSavedFolderField();
1404                 isSave = true;
1405                 isDir = true;
1406             } else if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1407                 title = "\83R\83\81\83\93\83g\82Ì\95Û\91\90æ(\83t\83@\83C\83\8b)";
1408                 field = savePanel.getCommentSavedFileField();
1409                 isSave = true;
1410                 isDir = false;
1411             } else {
1412                 return;
1413             }
1414             showSaveDialog(title, field, isSave, isDir);
1415         }
1416     }
1417
1418     private class OutputVideoPanelButtonListener implements ActionListener {
1419
1420         public void actionPerformed(ActionEvent e) {
1421             final Object source = e.getSource();
1422             String title;
1423             JTextField field;
1424             boolean isSave;
1425             boolean isDir;
1426             if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1427                 title = "\83R\83\81\83\93\83g\95t\82«\93®\89æ\82Ì\95Û\91\90æ(\83t\83H\83\8b\83_)";
1428                 field = savePanel.getConvertedVideoSavedFolderField();
1429                 isSave = true;
1430                 isDir = true;
1431             } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1432                 title = "\83R\83\81\83\93\83g\95t\82«\93®\89æ\82Ì\95Û\91\90æ(\83t\83@\83C\83\8b)";
1433                 field = savePanel.getConvertedVideoSavedFileField();
1434                 isSave = true;
1435                 isDir = false;
1436             } else {
1437                 return;
1438             }
1439             showSaveDialog(title, field, isSave, isDir);
1440         }
1441     }
1442
1443     private class VideoUseRadioButtonListener implements ActionListener {
1444
1445         public void actionPerformed(ActionEvent e) {
1446             Object source = e.getSource();
1447             if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1448                 maskExt();
1449             } else {
1450                 maskBase();
1451             }
1452         }
1453
1454         private void maskBase() {
1455             mask(true);
1456         }
1457
1458         private void maskExt() {
1459             mask(false);
1460         }
1461
1462         private void mask(boolean b) {
1463             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1464             VideoID_TextField.setEditable(b);
1465             panel.getDelVideoCheckBox().setEnabled(b);
1466
1467             panel.getSaveFolderRadioButton().setEnabled(b);
1468             panel.getVideoSavedFolderField().setEnabled(b);
1469             panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1470
1471             panel.getSaveFileRadioButton().setEnabled(b);
1472             panel.getVideoSavedFileField().setEnabled(b);
1473             panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1474
1475             panel.getNibrFileField().setEnabled(!b);
1476             panel.getNibrFileChooserButton().setEnabled(!b);
1477         }
1478     }
1479 }
1480
1481 class MainFrame_this_windowAdapter extends WindowAdapter {
1482
1483     private MainFrame adaptee;
1484
1485     MainFrame_this_windowAdapter(MainFrame adaptee) {
1486         this.adaptee = adaptee;
1487     }
1488
1489     @Override
1490     public void windowClosing(WindowEvent e) {
1491         adaptee.this_windowClosing(e);
1492     }
1493 }
1494
1495 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1496
1497     private MainFrame adaptee;
1498
1499     MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1500         this.adaptee = adaptee;
1501     }
1502
1503     public void actionPerformed(ActionEvent e) {
1504         adaptee.SettingFontPathButton_actionPerformed(e);
1505     }
1506 }
1507
1508 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1509
1510     private MainFrame adaptee;
1511
1512     MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1513         this.adaptee = adaptee;
1514     }
1515
1516     public void actionPerformed(ActionEvent e) {
1517         adaptee.SettingVhookPathButton_actionPerformed(e);
1518     }
1519 }
1520
1521 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1522
1523     private MainFrame adaptee;
1524
1525     MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1526         this.adaptee = adaptee;
1527     }
1528
1529     public void actionPerformed(ActionEvent e) {
1530         adaptee.SettingFFmpegPathButton_actionPerformed(e);
1531     }
1532 }
1533
1534 class MainFrame_DoButton_actionAdapter implements ActionListener {
1535
1536     private MainFrame adaptee;
1537
1538     MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1539         this.adaptee = adaptee;
1540     }
1541
1542     public void actionPerformed(ActionEvent e) {
1543         adaptee.DoButton_actionPerformed(e);
1544     }
1545 }
1546
1547 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1548
1549     MainFrame adaptee;
1550
1551     MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1552         this.adaptee = adaptee;
1553     }
1554
1555     public void actionPerformed(ActionEvent actionEvent) {
1556         adaptee.jMenuFileExit_actionPerformed(actionEvent);
1557     }
1558 }
1559
1560 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1561
1562     MainFrame adaptee;
1563
1564     MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1565         this.adaptee = adaptee;
1566     }
1567
1568     public void actionPerformed(ActionEvent actionEvent) {
1569         adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
1570     }
1571 }