OSDN Git Service

videoInfoPanelのレイアウトをGroupLayoutで書き直し
[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 java.util.logging.Level;
22 import java.util.logging.Logger;
23 import javax.swing.BorderFactory;
24 import javax.swing.ButtonGroup;
25 import javax.swing.GroupLayout;
26 import javax.swing.JButton;
27 import javax.swing.JCheckBox;
28 import javax.swing.JComboBox;
29 import javax.swing.JFileChooser;
30 import javax.swing.JFrame;
31 import javax.swing.JLabel;
32 import javax.swing.JMenu;
33 import javax.swing.JMenuBar;
34 import javax.swing.JMenuItem;
35 import javax.swing.JOptionPane;
36 import javax.swing.JPanel;
37 import javax.swing.JPasswordField;
38 import javax.swing.JRadioButton;
39 import javax.swing.JTabbedPane;
40 import javax.swing.JTextField;
41 import javax.swing.LayoutStyle.ComponentPlacement;
42 import javax.swing.SwingUtilities;
43 import nicobrowser.entity.NicoContent;
44 import nicobrowser.main.Main;
45 import org.apache.commons.lang.StringUtils;
46 import saccubus.ConvertStopFlag.State;
47 import saccubus.converter.profile.FfmpegOption;
48 import saccubus.converter.profile.NgSetting;
49 import saccubus.net.TextProgressListener;
50 import saccubus.properties.BasicSetting;
51 import saccubus.properties.ConvertSetting;
52 import saccubus.properties.InputCommentSetting;
53 import saccubus.properties.InputVideoSetting;
54 import saccubus.properties.SProperties;
55 import saccubus.properties.InputTcommentSetting;
56 import saccubus.properties.MovieSetting;
57 import saccubus.properties.OutputVideoSetting;
58 import saccubus.util.FileDropTarget;
59 import saccubus.util.PopupRightClick;
60 import yukihane.nicovideo.NicoDBFinder;
61
62 /**
63  * <p>
64  * タイトル: さきゅばす
65  * </p>
66  *
67  * <p>
68  * 説明: ニコニコ動画の動画をコメントつきで保存
69  * </p>
70  *
71  * <p>
72  * 著作権: Copyright (c) 2007 PSI
73  * </p>
74  *
75  * <p>
76  * 会社名:
77  * </p>
78  *
79  * @author 未入力
80  * @version 1.0
81  */
82 public class MainFrame extends JFrame {
83
84     private static final long serialVersionUID = 2564486741331062989L;
85     public static final String PRODUCT_NAME = "いんきゅばす";
86     public static final String VERSION = "1.7.1 (NicoBrowser" + Main.VERSION + ")";
87     public static final Image WinIcon = Toolkit.getDefaultToolkit().createImage(saccubus.MainFrame.class.getResource(
88             "icon32.png"));
89     // TODO GUIが無いためフィールドに保持.
90     private File tempDir;
91     JPanel contentPane;
92     BorderLayout borderLayout1 = new BorderLayout();
93     JMenuBar jMenuBar1 = new JMenuBar();
94     JMenu jMenuFile = new JMenu();
95     JMenuItem jMenuFileExit = new JMenuItem();
96     JMenu jMenuHelp = new JMenu();
97     JMenuItem jMenuHelpAbout = new JMenuItem();
98     JLabel statusBar = new JLabel();
99     JTabbedPane mainTabbedPane = new JTabbedPane();
100     JPanel SavingInfoTabPanel = new JPanel();
101     JPanel FFMpegTabPanel = new JPanel();
102     // メインウィンドウ
103     private JPanel videoInfoPanel = new JPanel();
104     private JPanel opPanel = new JPanel();
105     private JLabel videoIdLabel = new JLabel();
106     private JTextField videoIdField = new JTextField();
107     private JLabel wayBackLabel = new JLabel();
108     private JTextField wayBackField = new JTextField();
109     private JButton doButton = new JButton();
110     public static final String DoButtonDefString = "変換";
111     public static final String DoButtonStopString = "停止";
112     public static final String DoButtonWaitString = "待機";
113     JPanel UserInfoPanel = new JPanel();
114     GridBagLayout gridBagLayout3 = new GridBagLayout();
115     // ユーザ設定
116     JLabel mailAddressLabel = new JLabel();
117     JTextField mailAddressField = new JTextField();
118     JLabel passwordLabel = new JLabel();
119     JPasswordField passwordField = new JPasswordField();
120     GridBagLayout gridBagLayout4 = new GridBagLayout();
121     GridBagLayout gridBagLayout6 = new GridBagLayout();
122     ButtonGroup CommentSaveButtonGroup = new ButtonGroup();
123     ButtonGroup ConvSaveButtonGroup = new ButtonGroup();
124
125     private class FfmpegOptionCheckBoxListener implements ActionListener{
126
127         @Override
128         public void actionPerformed(ActionEvent e) {
129             setFFMpegOptionCheckbox();
130         }
131     }
132     private final FfmpegOptionCheckBoxListener ffmpegOptionCheckBoxListener = new FfmpegOptionCheckBoxListener();
133
134     private void setFFMpegOptionCheckbox() {
135         boolean resizable = (resizeCheckBox.isEnabled() && resizeCheckBox.isSelected());
136         resizeWidthField.setEnabled(resizable);
137         resizeHeigitField.setEnabled(resizable);
138         adjustRatioCheckBox.setEnabled(resizable);
139
140     }
141
142     private void setNames() {
143         mainTabbedPane.setName("mainTabbedPane");
144
145         mailAddressField.setName("mailAddressField");
146         passwordField.setName("passwordField");
147
148         ffmpegPathField.setName("ffmpegPathField");
149         vhookPathField.setName("vhookPathField");
150
151         mainOptionField.setName("mainOptionField");
152         inputOptionField.setName("inputOptionField");
153         outputOptionField.setName("outputOptionField");
154
155         fontPathField.setName("fontPathField");
156         fontIndexField.setName("fontIndexField");
157         showConvVideoCheckBox.setName("showConvVideoCheckBox");
158     }
159
160     public MainFrame() {
161         setNames();
162
163         videoSaveInfoPanel = savePanel.getVideoSaveInfoPanel();
164
165         try {
166             setDefaultCloseOperation(EXIT_ON_CLOSE);
167             jbInit();
168             setPopup();
169             setDropTarget();
170             SProperties setting = SProperties.loadSetting(null,
171                     null);
172             this.setSetting(setting);
173         } catch (Exception exception) {
174             exception.printStackTrace();
175         }
176     }
177
178     /**
179      * メイン画面最上部(ID/URL, 過去ログ, 変換ボタン)のパネルを初期化します.
180      */
181     private void initVideoInfoPanel() {
182
183         videoIdLabel.setText("URL/ID");
184         wayBackLabel.setText("過去ログ");
185         videoIdField.setText("http://www.nicovideo.jp/watch/");
186
187         final GroupLayout oppLayout = new GroupLayout(opPanel);
188         opPanel.setLayout(oppLayout);
189
190         oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
191                 .addGroup(oppLayout.createParallelGroup()
192                     .addComponent(videoIdLabel)
193                     .addComponent(wayBackLabel))
194                 .addGroup(oppLayout.createParallelGroup()
195                     .addComponent(videoIdField)
196                     .addGroup(oppLayout.createSequentialGroup()
197                         .addComponent(wayBackField)))
198                 );
199
200         oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
201                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
202                         .addComponent(videoIdLabel)
203                         .addComponent(videoIdField))
204                     .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
205                         .addComponent(wayBackLabel)
206                         .addComponent(wayBackField))
207                 );
208
209         doButton.setText(DoButtonDefString);
210         doButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
211
212         final GroupLayout vipLayout = new GroupLayout(videoInfoPanel);
213         videoInfoPanel.setLayout(vipLayout);
214
215         vipLayout.setHorizontalGroup(vipLayout.createSequentialGroup()
216                 .addComponent(opPanel).addComponent(doButton));
217
218         vipLayout.setVerticalGroup(vipLayout.createParallelGroup()
219                 .addComponent(opPanel).addComponent(doButton, 10, 20, 50));
220     }
221
222     /**
223      * コンポーネントの初期化。
224      *
225      * @throws java.lang.Exception
226      */
227     private void jbInit() throws Exception {
228
229         initVideoInfoPanel();
230
231         GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
232                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
233         gridBagConstraints74.gridwidth = 2;
234         GridBagConstraints gridBagConstraints73 = new GridBagConstraints();
235         gridBagConstraints73.fill = GridBagConstraints.HORIZONTAL;
236         gridBagConstraints73.gridy = 6;
237         gridBagConstraints73.weightx = 1.0;
238         gridBagConstraints73.gridwidth = 4;
239         gridBagConstraints73.insets = new Insets(0, 0, 0, 5);
240         gridBagConstraints73.gridx = 1;
241         GridBagConstraints gridBagConstraints72 = new GridBagConstraints();
242         gridBagConstraints72.gridx = 0;
243         gridBagConstraints72.anchor = GridBagConstraints.WEST;
244         gridBagConstraints72.insets = new Insets(0, 5, 0, 5);
245         gridBagConstraints72.fill = GridBagConstraints.NONE;
246         gridBagConstraints72.gridwidth = 1;
247         gridBagConstraints72.gridy = 6;
248         ShadowKindLabel = new JLabel();
249         ShadowKindLabel.setText("影の種類");
250         ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
251         GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
252         gridBagConstraints66.gridx = 0;
253         gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
254         gridBagConstraints66.anchor = GridBagConstraints.WEST;
255         gridBagConstraints66.gridwidth = 2;
256         gridBagConstraints66.gridy = 1;
257         ViewCommentLabel = new JLabel();
258         ViewCommentLabel.setText("表示コメント数");
259         GridBagConstraints gridBagConstraints65 = new GridBagConstraints();
260         gridBagConstraints65.fill = GridBagConstraints.HORIZONTAL;
261         gridBagConstraints65.gridy = 1;
262         gridBagConstraints65.weightx = 1.0;
263         gridBagConstraints65.gridwidth = 6;
264         gridBagConstraints65.insets = new Insets(0, 5, 5, 5);
265         gridBagConstraints65.gridx = 3;
266         GridBagConstraints gridBagConstraints64 = new GridBagConstraints(1, 1,
267                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
268                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
269         gridBagConstraints64.gridy = 3;
270         gridBagConstraints64.fill = GridBagConstraints.HORIZONTAL;
271         gridBagConstraints64.gridx = 4;
272         GridBagConstraints gridBagConstraints63 = new GridBagConstraints(0, 4,
273                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
274                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
275         gridBagConstraints63.gridy = 7;
276         gridBagConstraints63.gridx = 0;
277         gridBagConstraints63.gridwidth = 5;
278         GridBagConstraints gridBagConstraints62 = new GridBagConstraints(0, 3,
279                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
280                 GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0);
281         gridBagConstraints62.gridy = 5;
282         gridBagConstraints62.gridx = 1;
283         gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
284         gridBagConstraints62.insets = new Insets(0, 0, 5, 5);
285         gridBagConstraints62.gridwidth = 4;
286         GridBagConstraints gridBagConstraints61 = new GridBagConstraints(0, 2,
287                 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
288                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
289         gridBagConstraints61.gridy = 5;
290         gridBagConstraints61.gridx = 0;
291         gridBagConstraints61.fill = GridBagConstraints.VERTICAL;
292         gridBagConstraints61.anchor = GridBagConstraints.WEST;
293         gridBagConstraints61.gridwidth = 1;
294         GridBagConstraints gridBagConstraints60 = new GridBagConstraints(0, 1,
295                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
296                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0);
297         gridBagConstraints60.gridy = 3;
298         gridBagConstraints60.gridx = 1;
299         gridBagConstraints60.fill = GridBagConstraints.HORIZONTAL;
300         gridBagConstraints60.insets = new Insets(0, 0, 0, 5);
301         gridBagConstraints60.gridwidth = 3;
302         GridBagConstraints gridBagConstraints59 = new GridBagConstraints(0, 0,
303                 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
304                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);
305         gridBagConstraints59.gridy = 3;
306         gridBagConstraints59.insets = new Insets(5, 5, 5, 5);
307         gridBagConstraints59.gridx = 0;
308         gridBagConstraints59.fill = GridBagConstraints.NONE;
309         gridBagConstraints59.anchor = GridBagConstraints.WEST;
310         gridBagConstraints59.weightx = 0.0;
311         gridBagConstraints59.gridwidth = 1;
312         GridBagConstraints gridBagConstraints58 = new GridBagConstraints();
313         gridBagConstraints58.gridx = 0;
314         gridBagConstraints58.anchor = GridBagConstraints.WEST;
315         gridBagConstraints58.insets = new Insets(0, 5, 5, 5);
316         gridBagConstraints58.gridwidth = 5;
317         gridBagConstraints58.weightx = 1.0;
318         gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
319         gridBagConstraints58.gridy = 0;
320
321         GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
322                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
323         gridBagConstraints54.gridwidth = 3;
324
325         GridBagConstraints gridBagConstraints33 = new GridBagConstraints();
326         gridBagConstraints33.gridx = 0;
327         gridBagConstraints33.fill = GridBagConstraints.HORIZONTAL;
328         gridBagConstraints33.weightx = 1.0;
329         gridBagConstraints33.insets = new Insets(0, 5, 5, 5);
330         gridBagConstraints33.gridwidth = 5;
331         gridBagConstraints33.gridy = 9;
332
333         GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
334         gridBagConstraints14.gridx = 0;
335         gridBagConstraints14.anchor = GridBagConstraints.WEST;
336         gridBagConstraints14.fill = GridBagConstraints.HORIZONTAL;
337         gridBagConstraints14.weightx = 1.0;
338         gridBagConstraints14.gridwidth = 5;
339         gridBagConstraints14.insets = new Insets(0, 5, 0, 5);
340         gridBagConstraints14.gridy = 8;
341         GridBagConstraints gridBagConstraints7 = new GridBagConstraints(0, 0,
342                 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
343                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
344         gridBagConstraints7.weighty = 0.0;
345         GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
346         gridBagConstraints6.gridx = 0;
347         gridBagConstraints6.weighty = 1.0;
348         gridBagConstraints6.weightx = 1.0;
349         gridBagConstraints6.insets = new Insets(0, 5, 0, 5);
350         gridBagConstraints6.fill = GridBagConstraints.HORIZONTAL;
351         gridBagConstraints6.anchor = GridBagConstraints.NORTH;
352         gridBagConstraints6.gridy = 1;
353         GridBagConstraints gridBagConstraints1 = new GridBagConstraints(0, 1,
354                 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
355                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
356         gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
357         gridBagConstraints1.anchor = GridBagConstraints.NORTH;
358         gridBagConstraints1.weighty = 1.0;
359
360         this.setIconImage(WinIcon);
361         contentPane = (JPanel) this.getContentPane();
362         contentPane.setLayout(borderLayout1);
363         setSize(new Dimension(400, 450));
364         setTitle(PRODUCT_NAME + " " + VERSION);
365         this.addWindowListener(new MainFrame_this_windowAdapter(this));
366         statusBar.setText(" ");
367         jMenuFile.setText("ファイル");
368         jMenuFileExit.setText("終了");
369         jMenuFileExit.addActionListener(new MainFrame_jMenuFileExit_ActionAdapter(
370                 this));
371         jMenuHelp.setText("ヘルプ");
372         jMenuHelpAbout.setText("バージョン情報");
373         jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
374                 this));
375         SavingInfoTabPanel.setLayout(new GridLayout());
376         UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
377         UserInfoPanel.setLayout(gridBagLayout3);
378         mailAddressLabel.setText("メールアドレス");
379         passwordLabel.setText("パスワード");
380
381         setListenerToSavePanelButton();
382
383         FFMpegTabPanel.setLayout(gridBagLayout6);
384         PathSettingPanel.setBorder(BorderFactory.createTitledBorder(
385                 BorderFactory.createEtchedBorder(), "プログラムの位置の設定"));
386         PathSettingPanel.setLayout(gridBagLayout7);
387         FFmpegPathLabel.setText("FFmpeg");
388         SettingFFmpegPathButton.setText("参照");
389         SettingFFmpegPathButton.addActionListener(new MainFrame_SettingFFmpegPathButton_actionAdapter(
390                 this));
391         VhookPathLabel.setText("拡張vhookライブラリ");
392         SettingVhookPathButton.setText("参照");
393         SettingVhookPathButton.addActionListener(new MainFrame_SettingVhookPathButton_actionAdapter(
394                 this));
395         VhookSettingPanel.setLayout(gridBagLayout8);
396         VhookSettingPanel.setBorder(BorderFactory.createTitledBorder(
397                 BorderFactory.createEtchedBorder(), "拡張vhookライブラリの設定"));
398         FFmpegSettingPanel.setBorder(BorderFactory.createTitledBorder(
399                 BorderFactory.createEtchedBorder(), "FFmpegの設定"));
400         FFmpegSettingPanel.setLayout(gblFFmpegSettingPanel);
401         FontPathLabel.setText("フォントパス");
402         SettingFontPathButton.setText("参照");
403         SettingFontPathButton.addActionListener(new MainFrame_SettingFontPathButton_actionAdapter(
404                 this));
405         showConvVideoCheckBox.setText("変換中の画像を表示する");
406
407         extOptionLabel.setText("出力動画の拡張子");
408         inputOptionLabel.setText("入力オプション");
409         outputOptionLabel.setText("出力オプション");
410         mainOptionLabel.setText("メインオプション");
411         avfilterOptionLabel.setText("avfilterオプション");
412
413         FontIndexLabel.setText("フォント番号");
414
415         BasicInfoTabPanel.setLayout(gridBagLayout12);
416         jMenuBar1.add(jMenuFile);
417         jMenuFile.add(jMenuFileExit);
418         jMenuBar1.add(jMenuHelp);
419         jMenuHelp.add(jMenuHelpAbout);
420         setJMenuBar(jMenuBar1);
421
422         contentPane.add(statusBar, BorderLayout.SOUTH);
423         contentPane.add(mainTabbedPane, java.awt.BorderLayout.CENTER);
424         contentPane.add(videoInfoPanel, java.awt.BorderLayout.NORTH);
425         UserInfoPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1,
426                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
427                 new Insets(0, 5, 5, 5), 0, 0));
428         UserInfoPanel.add(mailAddressField, new GridBagConstraints(1, 0, 1, 1,
429                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
430                 new Insets(0, 5, 5, 5), 0, 0));
431         UserInfoPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1,
432                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
433                 new Insets(0, 5, 5, 0), 0, 0));
434         UserInfoPanel.add(mailAddressLabel, new GridBagConstraints(0, 0, 1, 1,
435                 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
436                 new Insets(0, 5, 5, 0), 0, 0));
437         PathSettingPanel.add(ffmpegPathField, new GridBagConstraints(0, 1, 1,
438                 1, 1.0, 0.0, GridBagConstraints.CENTER,
439                 GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));
440         PathSettingPanel.add(SettingFFmpegPathButton, gridBagConstraints74);
441         PathSettingPanel.add(FFmpegPathLabel, new GridBagConstraints(0, 0, 2,
442                 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
443                 new Insets(0, 5, 5, 5), 0, 0));
444         PathSettingPanel.add(vhookPathField, new GridBagConstraints(0, 3, 1, 1,
445                 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
446                 new Insets(0, 5, 5, 5), 0, 0));
447         PathSettingPanel.add(SettingVhookPathButton, new GridBagConstraints(1,
448                 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
449                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
450         PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
451
452
453         final GroupLayout layout = new GroupLayout(FFmpegSettingPanel);
454         FFmpegSettingPanel.setLayout(layout);
455
456         layout.setHorizontalGroup(layout.createParallelGroup()
457                 .addComponent(getFFmpegOptionComboBoxPanel())
458                 .addGroup(layout.createSequentialGroup()
459                     .addGroup(layout.createParallelGroup()
460                         .addComponent(extOptionLabel)
461                         .addComponent(mainOptionLabel)
462                         .addComponent(inputOptionLabel)
463                         .addComponent(outputOptionLabel)
464                         .addComponent(avfilterOptionLabel)
465                     )
466                     .addPreferredGap(ComponentPlacement.RELATED)
467                     .addGroup(layout.createParallelGroup()
468                         .addComponent(extOptionField)
469                         .addComponent(mainOptionField)
470                         .addComponent(inputOptionField)
471                         .addComponent(outputOptionField)
472                         .addComponent(avfilterOptionField)
473                     )
474                 )
475                 .addGroup(layout.createParallelGroup()
476                     .addGroup(layout.createSequentialGroup()
477                         .addComponent(resizeCheckBox)
478                         .addPreferredGap(ComponentPlacement.UNRELATED)
479                         .addComponent(resizeWidthLabel)
480                         .addPreferredGap(ComponentPlacement.RELATED)
481                         .addComponent(resizeWidthField)
482                         .addPreferredGap(ComponentPlacement.UNRELATED)
483                         .addComponent(resizeHeightLabel)
484                         .addPreferredGap(ComponentPlacement.RELATED)
485                         .addComponent(resizeHeigitField)
486                     )
487                 )
488                 .addGroup(layout.createSequentialGroup()
489                     .addGap(10)
490                     .addComponent(adjustRatioCheckBox))
491                 .addGroup(layout.createSequentialGroup()
492                     .addGap(20)
493                 )
494             );
495
496         layout.setVerticalGroup(layout.createSequentialGroup()
497             .addComponent(getFFmpegOptionComboBoxPanel())
498             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
499                 .addComponent(extOptionLabel)
500                 .addComponent(extOptionField))
501             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
502                 .addComponent(mainOptionLabel)
503                 .addComponent(mainOptionField))
504             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
505                 .addComponent(inputOptionLabel)
506                 .addComponent(inputOptionField))
507             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
508                 .addComponent(outputOptionLabel)
509                 .addComponent(outputOptionField))
510             .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
511                 .addComponent(avfilterOptionLabel)
512                 .addComponent(avfilterOptionField))
513             .addGroup(layout.createSequentialGroup()
514                 .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
515                     .addComponent(resizeCheckBox)
516                     .addComponent(resizeWidthLabel)
517                     .addComponent(resizeWidthField)
518                     .addComponent(resizeHeightLabel)
519                     .addComponent(resizeHeigitField))
520                 .addComponent(adjustRatioCheckBox)
521                 )
522             );
523
524         resizeCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
525         adjustRatioCheckBox.addActionListener(ffmpegOptionCheckBoxListener);
526         setFFMpegOptionCheckbox();
527
528
529
530         mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
531         mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
532         mainTabbedPane.add(FFMpegTabPanel, "動画設定");
533         mainTabbedPane.addTab("変換設定", null, getConvertingSettingPanel(), null);
534         SavingInfoTabPanel.add(savePanel);
535         BasicInfoTabPanel.add(UserInfoPanel, gridBagConstraints7);
536         BasicInfoTabPanel.add(getProxyInfoPanel(), gridBagConstraints6);
537         VhookSettingPanel.add(FontPathLabel, gridBagConstraints59);
538         VhookSettingPanel.add(showConvVideoCheckBox, gridBagConstraints63);
539         VhookSettingPanel.add(fontPathField, gridBagConstraints60);
540         VhookSettingPanel.add(fontIndexField, gridBagConstraints62);
541         VhookSettingPanel.add(FontIndexLabel, gridBagConstraints61);
542         VhookSettingPanel.add(SettingFontPathButton, gridBagConstraints64);
543         VhookSettingPanel.add(getFixFontSizeCheckBox(), gridBagConstraints14);
544         VhookSettingPanel.add(getOpaqueCommentCheckBox(), gridBagConstraints33);
545         VhookSettingPanel.add(getNotUseVhookCheckBox(), gridBagConstraints58);
546         VhookSettingPanel.add(getViewCommentField(), gridBagConstraints65);
547         VhookSettingPanel.add(ViewCommentLabel, gridBagConstraints66);
548         VhookSettingPanel.add(ShadowKindLabel, gridBagConstraints72);
549         VhookSettingPanel.add(getShadowComboBox(), gridBagConstraints73);
550
551         FFMpegTabPanel.add(PathSettingPanel, new GridBagConstraints(0, 0, 1, 1,
552                 1.0, 0.0, GridBagConstraints.NORTHEAST,
553                 GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
554         FFMpegTabPanel.add(FFmpegSettingPanel, gridBagConstraints1);
555     }
556
557     /**
558      * 保存設定パネル内のボタンにアクションリスナを割り当てる.
559      */
560     private void setListenerToSavePanelButton() {
561         ActionListener al;
562         al = new InputVideoPanelButtonListener();
563         videoSaveInfoPanel.getShowSavingVideoFolderDialogButton().addActionListener(al);
564         videoSaveInfoPanel.getShowSavingVideoFileDialogButton().addActionListener(al);
565         videoSaveInfoPanel.getNibrFileChooserButton().addActionListener(al);
566
567         al = new VideoUseRadioButtonListener();
568         videoSaveInfoPanel.getVideoNoSaveButton().addActionListener(al);
569         videoSaveInfoPanel.getVideoSaveButton().addActionListener(al);
570         videoSaveInfoPanel.getVideoUseNiBrButton().addActionListener(al);
571
572         al = new InputCommentPanelButtonListener();
573         savePanel.getShowSavingCommentFolderDialogButton().addActionListener(al);
574         savePanel.getShowSavingCommentFileDialogButton().addActionListener(al);
575
576         al = new OutputVideoPanelButtonListener();
577         savePanel.getShowSavingConvertedVideoFolderDialogButton().addActionListener(al);
578         savePanel.getShowSavingConvertedVideoFileDialogButton().addActionListener(al);
579     }
580
581     private void setPopup() {
582         mainOptionField.addMouseListener(new PopupRightClick(
583                 this.mainOptionField));
584         inputOptionField.addMouseListener(new PopupRightClick(
585                 this.inputOptionField));
586         outputOptionField.addMouseListener(new PopupRightClick(
587                 this.outputOptionField));
588         savePanel.getCommentNumField().addMouseListener(new PopupRightClick(
589                 savePanel.getCommentNumField()));
590
591         savePanel.getCommentSavedFileField().addMouseListener(new PopupRightClick(
592                 savePanel.getCommentSavedFileField()));
593         savePanel.getCommentSavedFolderField().addMouseListener(new PopupRightClick(
594                 savePanel.getCommentSavedFolderField()));
595
596         savePanel.getConvertedVideoSavedFileField().addMouseListener(new PopupRightClick(
597                 savePanel.getConvertedVideoSavedFileField()));
598         savePanel.getConvertedVideoSavedFolderField().addMouseListener(new PopupRightClick(
599                 savePanel.getConvertedVideoSavedFolderField()));
600
601         videoSaveInfoPanel.getVideoSavedFileField().addMouseListener(new PopupRightClick(
602                 videoSaveInfoPanel.getVideoSavedFileField()));
603         videoSaveInfoPanel.getVideoSavedFolderField().addMouseListener(new PopupRightClick(
604                 videoSaveInfoPanel.getVideoSavedFolderField()));
605         videoSaveInfoPanel.getNibrFileField().addMouseListener(
606                 new PopupRightClick(videoSaveInfoPanel.getNibrFileField()));
607
608         ffmpegPathField.addMouseListener(new PopupRightClick(
609                 this.ffmpegPathField));
610         vhookPathField.addMouseListener(new PopupRightClick(this.vhookPathField));
611         videoIdField.addMouseListener(new PopupRightClick(
612                 this.videoIdField));
613         viewCommentField.addMouseListener(new PopupRightClick(
614                 this.viewCommentField));
615         fontPathField.addMouseListener(new PopupRightClick(this.fontPathField));
616         mailAddressField.addMouseListener(new PopupRightClick(this.mailAddressField));
617         passwordField.addMouseListener(new PopupRightClick(this.passwordField));
618         wayBackField.addMouseListener(new PopupRightClick(this.wayBackField));
619
620         proxyTextField.addMouseListener(new PopupRightClick(this.proxyTextField));
621         proxyPortTextField.addMouseListener(new PopupRightClick(
622                 this.proxyPortTextField));
623
624         fontIndexField.addMouseListener(new PopupRightClick(this.fontIndexField));
625
626         ngWordTextField.addMouseListener(new PopupRightClick(
627                 this.ngWordTextField));
628         ngIdTextField.addMouseListener(new PopupRightClick(this.ngIdTextField));
629     }
630
631     private void setDropTarget() {
632         addTarget(videoSaveInfoPanel.getVideoSavedFileField(), false);
633         addTarget(videoSaveInfoPanel.getVideoSavedFolderField(), true);
634         addTarget(videoSaveInfoPanel.getNibrFileField(), false);
635
636         addTarget(savePanel.getCommentSavedFileField(), false);
637         addTarget(savePanel.getCommentSavedFolderField(), true);
638
639         addTarget(savePanel.getConvertedVideoSavedFileField(), false);
640         addTarget(savePanel.getConvertedVideoSavedFolderField(), true);
641
642         addTarget(ffmpegPathField, false);
643         addTarget(vhookPathField, false);
644         addTarget(fontPathField, false);
645
646     }
647
648     /**
649      * テキストフィールドに対しドロップを行った場合にファイルもしくはディレクトリの文字列を設定できるようにする.
650      * @param c 設定対象のテキストフィールドオブジェクト.
651      * @param isDir ディレクトリを設定する場合はtrue, ファイルの場合はfalse.
652      * @return ドロップターゲット(用途無し).
653      */
654     private DropTarget addTarget(JTextField c, boolean isDir) {
655         return new DropTarget(c, DnDConstants.ACTION_COPY, new FileDropTarget(
656                 c, isDir), true);
657     }
658     private File CurrentDir = new File(".");
659     private JPanel PathSettingPanel = new JPanel();
660     private JLabel FFmpegPathLabel = new JLabel();
661     private GridBagLayout gridBagLayout7 = new GridBagLayout();
662     private JTextField ffmpegPathField = new JTextField();
663     private JButton SettingFFmpegPathButton = new JButton();
664     private JLabel VhookPathLabel = new JLabel();
665     private JTextField vhookPathField = new JTextField();
666     private JButton SettingVhookPathButton = new JButton();
667     private JPanel VhookSettingPanel = new JPanel();
668     private GridBagLayout gridBagLayout8 = new GridBagLayout();
669     private JPanel FFmpegSettingPanel = new JPanel();
670     private GridBagLayout gblFFmpegSettingPanel = new GridBagLayout();
671     private JLabel FontPathLabel = new JLabel();
672     private JTextField fontPathField = new JTextField();
673     private JButton SettingFontPathButton = new JButton();
674     private JCheckBox showConvVideoCheckBox = new JCheckBox();
675
676     private void showSaveDialog(String title, JTextField field, boolean isSave,
677             boolean isDir) {
678         JFileChooser chooser = new JFileChooser(CurrentDir);
679         chooser.setDialogTitle(title);
680         int code = 0;
681         if (isDir) {
682             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
683         }
684         if (isSave) {
685             code = chooser.showSaveDialog(this);
686         } else {
687             code = chooser.showOpenDialog(this);
688         }
689         if (code == JFileChooser.APPROVE_OPTION) {
690             if (isDir) {
691                 CurrentDir = chooser.getSelectedFile();
692                 field.setText(CurrentDir.getAbsolutePath());
693             } else {
694                 File selected = chooser.getSelectedFile();
695                 CurrentDir = chooser.getCurrentDirectory();
696                 field.setText(selected.getAbsolutePath());
697             }
698         }
699     }
700
701     private SProperties getSetting() {
702         SProperties setting = new SProperties(
703                 getBasicSetting(),
704                 getInputVideoSetting(),
705                 getInputCommentSetting(),
706                 getTcommentSetting(),
707                 getOutputVideoSetting(),
708                 getMovieSetting(),
709                 getConvertSetting());
710         return setting;
711     }
712
713     /**
714      * 設定を画面に反映する.
715      * @param setting 反映する設定.
716      */
717     private void setSetting(SProperties setting) {
718         // 基本設定
719         final BasicSetting basic = setting.getBasicSetting();
720         tempDir = basic.getTempDir();
721         mailAddressField.setText(basic.getUser().getMail());
722         passwordField.setText(basic.getUser().getPassword());
723         // プロキシ関連
724         useProxyCheckBox.setSelected(basic.isProxyUse());
725         proxyTextField.setText(basic.getProxyHost());
726         int proxy_port = basic.getProxyPort();
727         if (proxy_port >= 0 && proxy_port <= 65535) {
728             proxyPortTextField.setText(Integer.toString(proxy_port));
729         } else {
730             proxyPortTextField.setText("");
731         }
732
733         // 保存設定 - 入力動画
734         final InputVideoSetting inVideo = setting.getInputVideoSetting();
735         JRadioButton activeButton;
736         switch (inVideo.getProcessKind()) {
737             case NO_SAVE:
738                 activeButton = videoSaveInfoPanel.getVideoNoSaveButton();
739                 break;
740             case NICOBROWSER:
741                 activeButton = videoSaveInfoPanel.getVideoUseNiBrButton();
742                 break;
743             case SAVE:
744             default:
745                 activeButton = videoSaveInfoPanel.getVideoSaveButton();
746                 break;
747         }
748         activeButton.doClick();
749
750         videoSaveInfoPanel.getVideoSavedFileField().setText(inVideo.getFile().getPath());
751         videoSaveInfoPanel.getVideoSavedFolderField().setText(inVideo.getFolder().getPath());
752         videoSaveInfoPanel.getDelVideoCheckBox().setSelected(inVideo.isDeleteAfterConvert());
753         final boolean videoFixName = inVideo.isAutoNaming();
754         videoSaveInfoPanel.getSaveFileRadioButton().setSelected(!videoFixName);
755         videoSaveInfoPanel.getSaveFolderRadioButton().setSelected(videoFixName);
756         videoSaveInfoPanel.getNibrFileField().setText(inVideo.getNicoBrowserFile().getPath());
757
758         // 保存設定 - 入力コメント
759         final InputCommentSetting inputComment = setting.getInputCommentSetting();
760         savePanel.getSavingCommentCheckBox().setSelected(inputComment.getProcessKind());
761         savePanel.getCommentSavedFileField().setText(inputComment.getFile().getPath());
762         savePanel.getDelCommentCheckBox().setSelected(inputComment.isDeleteAfterConvert());
763         savePanel.getCommentSavedFolderField().setText(inputComment.getFolder().getPath());
764         savePanel.getCommentNumField().setText(Integer.toString(inputComment.getNumOfComment()));
765         savePanel.getFixCommentNumCheckBox().setSelected(inputComment.isSelfAdjustNumOfComment());
766         boolean commentFixName = inputComment.isAutoNaming();
767         savePanel.getCommentSaveFileRadioButton().setSelected(!commentFixName);
768         savePanel.getCommentSaveFolderRadioButton().setSelected(commentFixName);
769
770         // 投稿者コメント
771         InputTcommentSetting tcom = setting.getInputTcommentSetting();
772         savePanel.setTcommentDownload(tcom.getProcessKind());
773         savePanel.setTcommentDelete(tcom.isDeleteAfterConvert());
774         savePanel.setTcommentAutoFileName(tcom.isAutoNaming());
775         savePanel.setTcommentDirectoryName(tcom.getFolder().getPath());
776         savePanel.setTcommentFileName(tcom.getFile().getPath());
777
778         // 保存設定 - 出力コメント付き動画
779         final OutputVideoSetting outputVideo = setting.getOutputVideoSetting();
780         savePanel.getSavingConvertedVideoCheckBox().setSelected(outputVideo.getProcessKind());
781         savePanel.getAddCommentCheckBox().setSelected(outputVideo.isAddComment());
782         savePanel.getAddTcommentCheckBox().setSelected(outputVideo.isAddTcomment());
783         savePanel.getConvertedVideoSavedFileField().setText(outputVideo.getFile().getPath());
784         savePanel.getConvertedVideoSavedFolderField().setText(outputVideo.getFolder().getPath());
785         savePanel.getNotAddVideoIdConvVideoCheckBox().setSelected(outputVideo.isCutIdName());
786         boolean convFixName = outputVideo.isAutoNaming();
787         savePanel.getConvSaveFileRadioButton().setSelected(!convFixName);
788         savePanel.getConvSaveFolderRadioButton().setSelected(convFixName);
789
790         // 動画設定
791         final MovieSetting movie = setting.getMovieSetting();
792         ffmpegPathField.setText(movie.getFfmpeg().toString());
793         vhookPathField.setText(movie.getVhook().toString());
794         extOptionField.setText(movie.getFfmpegOption().getExtOption());
795         mainOptionField.setText(movie.getFfmpegOption().getMainOption());
796         inputOptionField.setText(movie.getFfmpegOption().getInOption());
797         outputOptionField.setText(movie.getFfmpegOption().getOutOption());
798         avfilterOptionField.setText(movie.getFfmpegOption().getAvfilterOption());
799         resizeCheckBox.setSelected(movie.getFfmpegOption().isResize());
800         resizeWidthField.setText(Integer.toString(movie.getFfmpegOption().getResizeWidth()));
801         resizeHeigitField.setText(Integer.toString(movie.getFfmpegOption().getResizeHeight()));
802         adjustRatioCheckBox.setSelected(movie.getFfmpegOption().isAdjustRatio());
803         FFmpegOptionModel.reload(movie.getOptionFile());
804
805         // 変換設定
806         final ConvertSetting conv = setting.getConvertSetting();
807         disableVhookCheckBox.setSelected(conv.isVhookDisabled());
808         viewCommentField.setText(Integer.toString(conv.getMaxNumOfComment()));
809         fontPathField.setText(conv.getFont().toString());
810         fontIndexField.setText(Integer.toString(conv.getFontIndex()));
811         shadowComboBox.setSelectedIndex(conv.getShadowIndex());
812         showConvVideoCheckBox.setSelected(conv.isShowConverting());
813         fixFontSizeCheckBox.setSelected(conv.isSelfAdjustFontSize());
814         opaqueCommentCheckBox.setSelected(conv.isCommentOpaque());
815         ngWordTextField.setText(conv.getNgSetting().getWord());
816         ngIdTextField.setText(conv.getNgSetting().getId());
817     }
818
819     /**
820      * [ファイル|終了] アクションが実行されました。
821      *
822      * @param actionEvent
823      *            ActionEvent
824      */
825     void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
826         try {
827             SProperties setting = getSetting();
828             SProperties.saveSetting(setting);
829         } catch (Throwable t) {
830             Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "設定保存に失敗", t);
831         }
832         System.exit(0);
833     }
834
835     /**
836      * [ヘルプ|バージョン情報] アクションが実行されました。
837      *
838      * @param actionEvent
839      *            ActionEvent
840      */
841     void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
842         MainFrame_AboutBox dlg = new MainFrame_AboutBox(this);
843         dlg.pack();
844         dlg.setLocationRelativeTo(this);
845         dlg.setVisible(true);
846     }
847
848     /* 変換・保存する */
849     private Converter Converter = null;
850     // FFmpegの設定 ここから
851     private final JLabel extOptionLabel = new JLabel();
852     private final JTextField extOptionField = new JTextField();
853     private JLabel mainOptionLabel = new JLabel();
854     private JTextField mainOptionField = new JTextField();
855     private JLabel inputOptionLabel = new JLabel();
856     private JTextField inputOptionField = new JTextField();
857     private JLabel outputOptionLabel = new JLabel();
858     private JTextField outputOptionField = new JTextField();
859     private final JLabel avfilterOptionLabel = new JLabel();
860     private final JTextField avfilterOptionField = new JTextField();
861     private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)");
862     private final JLabel resizeWidthLabel = new JLabel("横");
863     private final JTextField resizeWidthField = new NumberFormattedTextField();
864     private final JLabel resizeHeightLabel = new JLabel("縦");
865     private final JTextField resizeHeigitField = new NumberFormattedTextField();
866     private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
867     // FFmpegの設定 ここまで
868     private JLabel FontIndexLabel = new JLabel();
869     private JTextField fontIndexField = new JTextField();
870     private JPanel BasicInfoTabPanel = new JPanel();
871     private GridBagLayout gridBagLayout12 = new GridBagLayout();
872     private JPanel ConvertingSettingPanel = null;
873     private JPanel NGWordSettingPanel = null;
874     private JLabel NGWordLabel = null;
875     private JTextField ngWordTextField = null;
876     private JLabel NGIDLabel = null;
877     private JTextField ngIdTextField = null;
878     // プロキシ設定
879     private JPanel ProxyInfoPanel = null;
880     private JCheckBox useProxyCheckBox = null;
881     private JLabel proxyLabel = null;
882     private JTextField proxyTextField = null;
883     private JLabel proxyPortLabel = null;
884     private JTextField proxyPortTextField = null;
885     //
886     private JCheckBox fixFontSizeCheckBox = null;
887     private JCheckBox opaqueCommentCheckBox = null;
888     private final SavePanel savePanel = new SavePanel();
889     private final VideoSaveInfoPanel videoSaveInfoPanel;
890     private JComboBox FFmpegOptionComboBox = null;
891     private JButton FFmpegOptionReloadButton = null;
892     private JPanel FFmpegOptionComboBoxPanel = null;
893
894     public void DoButton_actionPerformed(ActionEvent e) {
895         if (Converter == null || Converter.isConverted()) {
896             try {
897                 executeConvert();
898             } catch (Exception ex) {
899                 String text = ex.getMessage();
900                 if (StringUtils.isEmpty(text)) {
901                     text = "予期しないエラーのため中断しました。";
902                 }
903                 ex.printStackTrace();
904                 statusBar.setText(text);
905             }
906         } else { /* 開始しているので、ストップする。 */
907             final ConvertStopFlag flag = Converter.getStopFlag();
908             if (!flag.needStop()) { /* まだストップしていない。 */
909                 flag.requestStop();
910             }
911         }
912     }
913
914     private void executeConvert() throws IOException {
915         String url;
916
917         // NicoBrowserファイルを利用する場合は、ファイル名からビデオIDを特定.
918         if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected()) {
919             try {
920                 String fileName = videoSaveInfoPanel.getNibrFileField().getText();
921                 NicoDBFinder finder = NicoDBFinder.getInstance();
922                 NicoContent info = finder.findNicoContent(fileName);
923                 if (info != null) {
924                     url = info.getNicoId();
925                 } else {
926                     url = "";
927                 }
928             } catch (Exception ex) {
929                 JOptionPane.showMessageDialog(this, ex.getMessage(), "エラー", JOptionPane.ERROR_MESSAGE);
930                 return;
931             }
932         } else {
933             url = videoIdField.getText();
934         }
935
936         TextProgressListener sl = new TextProgressListener() {
937
938             public void setText(final String text) {
939                 SwingUtilities.invokeLater(new Runnable() {
940
941                     public void run() {
942                         statusBar.setText(text);
943                     }
944                 });
945             }
946         };
947
948         ConvertStopFlag.StateChangeListener scl = new ConvertStopFlag.StateChangeListener() {
949
950             public void changeState(final State s) {
951                 SwingUtilities.invokeLater(new Runnable() {
952
953                     public void run() {
954                         switch (s) {
955                             case STOPPING:
956                                 doButton.setText(DoButtonWaitString);
957                                 break;
958                             case FINISHED:
959                                 doButton.setText(DoButtonDefString);
960                         }
961                     }
962                 });
963             }
964         };
965
966         Converter = new Converter(url, wayBackField.getText(), getSetting().toProfile(), sl,
967                 new ConvertStopFlag(scl));
968         doButton.setText(DoButtonStopString);
969         new Thread(Converter).start();
970
971     }
972
973     /* FFmpegへのパス */
974     public void SettingFFmpegPathButton_actionPerformed(ActionEvent e) {
975         showSaveDialog("FFmpegへのパス", ffmpegPathField, false, false);
976     }
977
978     public void SettingVhookPathButton_actionPerformed(ActionEvent e) {
979         showSaveDialog("拡張vhookライブラリへのパス", vhookPathField, false, false);
980     }
981
982     public void SettingFontPathButton_actionPerformed(ActionEvent e) {
983         showSaveDialog("フォントへのパス", fontPathField, false, false);
984     }
985
986     public void this_windowClosing(WindowEvent e) {
987         this.jMenuFileExit_actionPerformed(null);
988     }
989
990     /**
991      * This method initializes ConvertingSettingPanel
992      *
993      * @return javax.swing.JPanel
994      */
995     private JPanel getConvertingSettingPanel() {
996         if (ConvertingSettingPanel == null) {
997             GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
998             gridBagConstraints11.weighty = 1.0;
999             gridBagConstraints11.weightx = 1.0;
1000             gridBagConstraints11.insets = new Insets(0, 5, 0, 5);
1001             gridBagConstraints11.gridy = 1;
1002             gridBagConstraints11.gridx = 0;
1003             gridBagConstraints11.anchor = GridBagConstraints.NORTH;
1004             gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
1005             GridBagConstraints gridBagConstraints = new GridBagConstraints(0,
1006                     2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTH,
1007                     GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0);
1008             gridBagConstraints.gridx = 0;
1009             gridBagConstraints.anchor = GridBagConstraints.CENTER;
1010             gridBagConstraints.weighty = 0.0;
1011             gridBagConstraints.gridy = 0;
1012             ConvertingSettingPanel = new JPanel();
1013             ConvertingSettingPanel.setLayout(new GridBagLayout());
1014             ConvertingSettingPanel.add(getNGWordSettingPanel(),
1015                     gridBagConstraints11);
1016             ConvertingSettingPanel.add(VhookSettingPanel, gridBagConstraints);
1017         }
1018         return ConvertingSettingPanel;
1019     }
1020
1021     /**
1022      * This method initializes NGWordSettingPanel
1023      *
1024      * @return javax.swing.JPanel
1025      */
1026     private JPanel getNGWordSettingPanel() {
1027         if (NGWordSettingPanel == null) {
1028             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
1029             gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
1030             gridBagConstraints5.gridy = 1;
1031             gridBagConstraints5.weightx = 1.0;
1032             gridBagConstraints5.insets = new Insets(0, 5, 5, 5);
1033             gridBagConstraints5.gridx = 1;
1034             GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
1035             gridBagConstraints4.gridx = 0;
1036             gridBagConstraints4.anchor = GridBagConstraints.WEST;
1037             gridBagConstraints4.insets = new Insets(0, 5, 5, 0);
1038             gridBagConstraints4.gridy = 1;
1039             NGIDLabel = new JLabel();
1040             NGIDLabel.setText("NG ID");
1041             GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
1042             gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL;
1043             gridBagConstraints3.gridy = 0;
1044             gridBagConstraints3.weightx = 1.0;
1045             gridBagConstraints3.insets = new Insets(0, 5, 5, 5);
1046             gridBagConstraints3.gridx = 1;
1047             GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
1048             gridBagConstraints2.gridx = 0;
1049             gridBagConstraints2.insets = new Insets(0, 5, 5, 0);
1050             gridBagConstraints2.gridy = 0;
1051             NGWordLabel = new JLabel();
1052             NGWordLabel.setText("NGワード");
1053             NGWordSettingPanel = new JPanel();
1054             NGWordSettingPanel.setLayout(new GridBagLayout());
1055             NGWordSettingPanel.setBorder(BorderFactory.createTitledBorder(null,
1056                     "NGワード・ID設定(半角スペース区切りで複数入力)"));
1057             NGWordSettingPanel.add(NGWordLabel, gridBagConstraints2);
1058             NGWordSettingPanel.add(getNGWordTextField(), gridBagConstraints3);
1059             NGWordSettingPanel.add(NGIDLabel, gridBagConstraints4);
1060             NGWordSettingPanel.add(getNGIDTextField(), gridBagConstraints5);
1061         }
1062         return NGWordSettingPanel;
1063     }
1064
1065     /**
1066      * This method initializes NGWordTextField
1067      *
1068      * @return javax.swing.JTextField
1069      */
1070     private JTextField getNGWordTextField() {
1071         if (ngWordTextField == null) {
1072             ngWordTextField = new JTextField();
1073             ngWordTextField.setName("ngWordTextField");
1074         }
1075         return ngWordTextField;
1076     }
1077
1078     /**
1079      * This method initializes NGIDTextField
1080      *
1081      * @return javax.swing.JTextField
1082      */
1083     private JTextField getNGIDTextField() {
1084         if (ngIdTextField == null) {
1085             ngIdTextField = new JTextField();
1086             ngIdTextField.setName("ngIdTextField");
1087         }
1088         return ngIdTextField;
1089     }
1090
1091     /**
1092      * This method initializes ProxyInfoPanel
1093      *
1094      * @return javax.swing.JPanel
1095      */
1096     private JPanel getProxyInfoPanel() {
1097         if (ProxyInfoPanel == null) {
1098             GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
1099             gridBagConstraints13.gridx = 0;
1100             gridBagConstraints13.gridwidth = 2;
1101             gridBagConstraints13.weightx = 1.0;
1102             gridBagConstraints13.fill = GridBagConstraints.HORIZONTAL;
1103             gridBagConstraints13.insets = new Insets(0, 5, 0, 5);
1104             gridBagConstraints13.gridy = 0;
1105             GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
1106             gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
1107             gridBagConstraints12.gridy = 2;
1108             gridBagConstraints12.weightx = 1.0;
1109             gridBagConstraints12.insets = new Insets(5, 0, 5, 5);
1110             gridBagConstraints12.gridx = 1;
1111             GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
1112             gridBagConstraints10.gridx = 0;
1113             gridBagConstraints10.insets = new Insets(5, 5, 5, 5);
1114             gridBagConstraints10.gridy = 2;
1115             proxyPortLabel = new JLabel();
1116             proxyPortLabel.setText("ポート番号");
1117             GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
1118             gridBagConstraints9.fill = GridBagConstraints.BOTH;
1119             gridBagConstraints9.gridy = 1;
1120             gridBagConstraints9.weightx = 1.0;
1121             gridBagConstraints9.insets = new Insets(0, 0, 0, 5);
1122             gridBagConstraints9.gridx = 1;
1123             GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
1124             gridBagConstraints8.gridx = 0;
1125             gridBagConstraints8.insets = new Insets(0, 5, 0, 5);
1126             gridBagConstraints8.fill = GridBagConstraints.NONE;
1127             gridBagConstraints8.anchor = GridBagConstraints.EAST;
1128             gridBagConstraints8.gridy = 1;
1129             proxyLabel = new JLabel();
1130             proxyLabel.setText("プロキシ");
1131             ProxyInfoPanel = new JPanel();
1132             ProxyInfoPanel.setLayout(new GridBagLayout());
1133             ProxyInfoPanel.setBorder(BorderFactory.createTitledBorder(null,
1134                     "プロキシ設定"));
1135             ProxyInfoPanel.add(proxyLabel, gridBagConstraints8);
1136             ProxyInfoPanel.add(getProxyTextField(), gridBagConstraints9);
1137             ProxyInfoPanel.add(proxyPortLabel, gridBagConstraints10);
1138             ProxyInfoPanel.add(getProxyPortTextField(), gridBagConstraints12);
1139             ProxyInfoPanel.add(getUseProxyCheckBox(), gridBagConstraints13);
1140         }
1141         return ProxyInfoPanel;
1142     }
1143
1144     /**
1145      * This method initializes ProxyTextField
1146      *
1147      * @return javax.swing.JTextField
1148      */
1149     private JTextField getProxyTextField() {
1150         if (proxyTextField == null) {
1151             proxyTextField = new JTextField();
1152             proxyTextField.setName("proxyTextField");
1153         }
1154         return proxyTextField;
1155     }
1156
1157     /**
1158      * This method initializes ProxyPortTextField
1159      *
1160      * @return javax.swing.JTextField
1161      */
1162     private JTextField getProxyPortTextField() {
1163         if (proxyPortTextField == null) {
1164             proxyPortTextField = new JTextField();
1165             proxyPortTextField.setName("proxyPortTextField");
1166         }
1167         return proxyPortTextField;
1168     }
1169
1170     /**
1171      * This method initializes UseProxyCheckBox
1172      *
1173      * @return javax.swing.JCheckBox
1174      */
1175     private JCheckBox getUseProxyCheckBox() {
1176         if (useProxyCheckBox == null) {
1177             useProxyCheckBox = new JCheckBox();
1178             useProxyCheckBox.setText("プロキシを使う");
1179             useProxyCheckBox.setName("useProxyCheckBox");
1180         }
1181         return useProxyCheckBox;
1182     }
1183
1184     /**
1185      * This method initializes FixFontSizeCheckBox
1186      *
1187      * @return javax.swing.JCheckBox
1188      */
1189     private JCheckBox getFixFontSizeCheckBox() {
1190         if (fixFontSizeCheckBox == null) {
1191             fixFontSizeCheckBox = new JCheckBox();
1192             fixFontSizeCheckBox.setText("フォントサイズを画面にあわせて自動調整する");
1193             fixFontSizeCheckBox.setName("fixFontSizeCheckBox");
1194         }
1195         return fixFontSizeCheckBox;
1196     }
1197
1198     /**
1199      * This method initializes OpaqueCommentCheckBox
1200      *
1201      * @return javax.swing.JCheckBox
1202      */
1203     private JCheckBox getOpaqueCommentCheckBox() {
1204         if (opaqueCommentCheckBox == null) {
1205             opaqueCommentCheckBox = new JCheckBox();
1206             opaqueCommentCheckBox.setText("全てのコメントを不透明にする");
1207             opaqueCommentCheckBox.setName("opaqueCommentCheckBox");
1208         }
1209         return opaqueCommentCheckBox;
1210     }
1211     /**
1212      * This method initializes FFmpegOptionComboBox
1213      *
1214      * @return javax.swing.JComboBox
1215      */
1216     private final OptionComboBoxModel FFmpegOptionModel = new OptionComboBoxModel();
1217     private JCheckBox disableVhookCheckBox = null;
1218     private JTextField viewCommentField = null;
1219     private JLabel ViewCommentLabel = null;
1220     private JLabel ShadowKindLabel = null;
1221     private JComboBox shadowComboBox = null;
1222
1223     private JComboBox getFFmpegOptionComboBox() {
1224         if (FFmpegOptionComboBox == null) {
1225             FFmpegOptionComboBox = new JComboBox(FFmpegOptionModel);
1226             FFmpegOptionComboBox.addActionListener(new java.awt.event.ActionListener() {
1227
1228                 public void actionPerformed(java.awt.event.ActionEvent e) {
1229                     if (FFmpegOptionModel.isFile()) {// ファイル
1230                         setFFMpegOptionEnabled(false);
1231                     } else {// ファイルでない
1232                         setFFMpegOptionEnabled(true);
1233                         setFFMpegOptionCheckbox();
1234                     }
1235                 }
1236
1237                 private void setFFMpegOptionEnabled(boolean enable) {
1238                     extOptionField.setEnabled(enable);
1239                     mainOptionField.setEnabled(enable);
1240                     inputOptionField.setEnabled(enable);
1241                     outputOptionField.setEnabled(enable);
1242                     avfilterOptionField.setEnabled(enable);
1243                     resizeCheckBox.setEnabled(enable);
1244                     resizeWidthField.setEnabled(enable);
1245                     resizeHeigitField.setEditable(enable);
1246                     adjustRatioCheckBox.setEnabled(enable);
1247                 }
1248             });
1249         }
1250         return FFmpegOptionComboBox;
1251     }
1252
1253     /**
1254      * This method initializes FFmpegOptionReloadButton
1255      *
1256      * @return javax.swing.JButton
1257      */
1258     private JButton getFFmpegOptionReloadButton() {
1259         if (FFmpegOptionReloadButton == null) {
1260             FFmpegOptionReloadButton = new JButton();
1261             FFmpegOptionReloadButton.setText("更新");
1262             FFmpegOptionReloadButton.addActionListener(new java.awt.event.ActionListener() {
1263
1264                 public void actionPerformed(java.awt.event.ActionEvent e) {
1265                     FFmpegOptionModel.reload();
1266                 }
1267             });
1268         }
1269         return FFmpegOptionReloadButton;
1270     }
1271
1272     /**
1273      * This method initializes FFmpegOptionComboBoxPanel
1274      *
1275      * @return javax.swing.JPanel
1276      */
1277     private JPanel getFFmpegOptionComboBoxPanel() {
1278         if (FFmpegOptionComboBoxPanel == null) {
1279             GridBagConstraints gridBagConstraints47 = new GridBagConstraints();
1280             gridBagConstraints47.fill = GridBagConstraints.BOTH;
1281             gridBagConstraints47.gridx = -1;
1282             gridBagConstraints47.gridy = -1;
1283             gridBagConstraints47.insets = new Insets(0, 0, 5, 5);
1284             GridBagConstraints gridBagConstraints46 = new GridBagConstraints();
1285             gridBagConstraints46.fill = GridBagConstraints.HORIZONTAL;
1286             gridBagConstraints46.gridwidth = 3;
1287             gridBagConstraints46.gridx = -1;
1288             gridBagConstraints46.gridy = -1;
1289             gridBagConstraints46.weightx = 1.0;
1290             gridBagConstraints46.insets = new Insets(0, 5, 5, 5);
1291             FFmpegOptionComboBoxPanel = new JPanel();
1292             FFmpegOptionComboBoxPanel.setLayout(new GridBagLayout());
1293             FFmpegOptionComboBoxPanel.add(getFFmpegOptionComboBox(),
1294                     gridBagConstraints46);
1295             FFmpegOptionComboBoxPanel.add(getFFmpegOptionReloadButton(),
1296                     gridBagConstraints47);
1297         }
1298         return FFmpegOptionComboBoxPanel;
1299     }
1300
1301     /**
1302      * This method initializes NotUseVhookCheckBox
1303      *
1304      * @return javax.swing.JCheckBox
1305      */
1306     private JCheckBox getNotUseVhookCheckBox() {
1307         if (disableVhookCheckBox == null) {
1308             disableVhookCheckBox = new JCheckBox();
1309             disableVhookCheckBox.setText("拡張vhookライブラリを無効にする(デバッグ用)");
1310             disableVhookCheckBox.setName("disableVhookCheckBox");
1311         }
1312         return disableVhookCheckBox;
1313     }
1314
1315     /**
1316      * This method initializes ViewCommentField
1317      *
1318      * @return javax.swing.JTextField
1319      */
1320     private JTextField getViewCommentField() {
1321         if (viewCommentField == null) {
1322             viewCommentField = new JTextField();
1323             viewCommentField.setName("viewCommentField");
1324         }
1325         return viewCommentField;
1326     }
1327
1328     /**
1329      * This method initializes ShadowComboBox
1330      *
1331      * @return javax.swing.JComboBox
1332      */
1333     private JComboBox getShadowComboBox() {
1334         if (shadowComboBox == null) {
1335             shadowComboBox = new JComboBox(SProperties.ShadowKindArray);
1336             shadowComboBox.setName("shadowComboBox");
1337         }
1338         return shadowComboBox;
1339     }
1340
1341     private BasicSetting getBasicSetting() {
1342         String mail = mailAddressField.getText();
1343         String pass = String.valueOf(passwordField.getPassword());
1344         boolean proxyUse = useProxyCheckBox.isSelected();
1345         String proxyHost = proxyTextField.getText();
1346         int proxyPort;
1347         try {
1348             proxyPort = Integer.parseInt(proxyPortTextField.getText());
1349         } catch (NumberFormatException e) {
1350             proxyPort = -1;
1351         }
1352         // TODO 作業用ディレクトリの設定GUI無し
1353         return new BasicSetting(tempDir, mail, pass, proxyUse, proxyHost, proxyPort);
1354     }
1355
1356     private InputVideoSetting getInputVideoSetting() {
1357         VideoSaveKind kind;
1358         if (videoSaveInfoPanel.getVideoNoSaveButton().isSelected() == true) {
1359             kind = VideoSaveKind.NO_SAVE;
1360         } else if (videoSaveInfoPanel.getVideoUseNiBrButton().isSelected() == true) {
1361             kind = VideoSaveKind.NICOBROWSER;
1362         } else {
1363             kind = VideoSaveKind.SAVE;
1364         }
1365         boolean autoNaming = videoSaveInfoPanel.getSaveFolderRadioButton().isSelected();
1366         String folder = videoSaveInfoPanel.getVideoSavedFolderField().getText();
1367         String file = videoSaveInfoPanel.getVideoSavedFileField().getText();
1368         boolean delete = videoSaveInfoPanel.getDelVideoCheckBox().isSelected();
1369         String nibrFile = videoSaveInfoPanel.getNibrFileField().getText();
1370
1371         return new InputVideoSetting(kind, autoNaming, new File(folder), new File(file), delete, new File(nibrFile));
1372     }
1373
1374     private InputCommentSetting getInputCommentSetting() {
1375         boolean download = savePanel.getSavingCommentCheckBox().isSelected();
1376         String file = savePanel.getCommentSavedFileField().getText();
1377         int back_comment;
1378         try {
1379             back_comment = Integer.parseInt(savePanel.getCommentNumField().getText());
1380         } catch (NumberFormatException ex) {
1381             back_comment = 500;
1382         }
1383         boolean delete = savePanel.getDelCommentCheckBox().isSelected();
1384         boolean autoNaming = savePanel.getCommentSaveFolderRadioButton().isSelected();
1385         String folder = savePanel.getCommentSavedFolderField().getText();
1386         boolean adjustNumOfCom = savePanel.getFixCommentNumCheckBox().isSelected();
1387
1388         return new InputCommentSetting(download, autoNaming, new File(folder), new File(file), delete, adjustNumOfCom,
1389                 back_comment);
1390     }
1391
1392     /**
1393      * 画面入力値から投稿者コメント設定を作成する.
1394      * @return 作成した投稿者コメント設定.
1395      */
1396     private InputTcommentSetting getTcommentSetting() {
1397         boolean down = savePanel.isTcommentDownload();
1398         boolean del = savePanel.isTcommentDelete();
1399         boolean naming = savePanel.isTcommentAutoFileName();
1400         String dir = savePanel.getTcommentDirectoryName();
1401         String f = savePanel.getTcommentFileName();
1402         return new InputTcommentSetting(down, naming, dir, f, del);
1403     }
1404
1405     private OutputVideoSetting getOutputVideoSetting() {
1406         boolean process = savePanel.getSavingConvertedVideoCheckBox().isSelected();
1407         boolean addComment = savePanel.getAddCommentCheckBox().isSelected();
1408         boolean addTcomment = savePanel.getAddTcommentCheckBox().isSelected();
1409         String file = savePanel.getConvertedVideoSavedFileField().getText();
1410         boolean cutId = savePanel.getNotAddVideoIdConvVideoCheckBox().isSelected();
1411         boolean autoNaming = savePanel.getConvSaveFolderRadioButton().isSelected();
1412         String folder = savePanel.getConvertedVideoSavedFolderField().getText();
1413
1414         return new OutputVideoSetting(process, autoNaming, new File(folder), new File(file), cutId, addComment,
1415                 addTcomment);
1416     }
1417
1418     private MovieSetting getMovieSetting() {
1419         String ffmpeg = ffmpegPathField.getText();
1420         String vhook = vhookPathField.getText();
1421         String ext = extOptionField.getText();
1422         String main = mainOptionField.getText();
1423         String in = inputOptionField.getText();
1424         String out = outputOptionField.getText();
1425         String avfilter = avfilterOptionField.getText();
1426         boolean resize = resizeCheckBox.isSelected();
1427         String width = resizeWidthField.getText();
1428         String height = resizeHeigitField.getText();
1429         boolean adjust = adjustRatioCheckBox.isSelected();
1430         File optionFile = FFmpegOptionModel.getSelectedFile();
1431
1432         FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust);
1433         return new MovieSetting(new File(ffmpeg), new File(vhook), optionFile, opt);
1434     }
1435
1436     private ConvertSetting getConvertSetting() {
1437         boolean vhookDisabled = disableVhookCheckBox.isSelected();
1438         int maxComment = 30;
1439         try {
1440             maxComment = Integer.parseInt(viewCommentField.getText());
1441         } catch (NumberFormatException ex) {
1442         }
1443         File font = new File(fontPathField.getText());
1444         int fontIndex = Integer.parseInt(fontIndexField.getText());
1445         int shadowIndex = shadowComboBox.getSelectedIndex();
1446         boolean showConv = showConvVideoCheckBox.isSelected();
1447         boolean adjustFont = fixFontSizeCheckBox.isSelected();
1448         boolean commentOpaque = opaqueCommentCheckBox.isSelected();
1449         NgSetting ngSetting = new NgSetting(ngWordTextField.getText(), ngIdTextField.getText());
1450
1451         return new ConvertSetting(vhookDisabled, maxComment, font, fontIndex, shadowIndex, showConv, adjustFont,
1452                 commentOpaque, ngSetting);
1453     }
1454
1455     private class InputVideoPanelButtonListener implements ActionListener {
1456
1457         public void actionPerformed(ActionEvent e) {
1458             final Object source = e.getSource();
1459             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1460             String title;
1461             JTextField field;
1462             boolean isSave;
1463             boolean isDir;
1464
1465             if (source == panel.getShowSavingVideoFolderDialogButton()) {
1466                 title = "動画の保存先(フォルダ)";
1467                 field = panel.getVideoSavedFolderField();
1468                 isSave = true;
1469                 isDir = true;
1470             } else if (source == panel.getShowSavingVideoFileDialogButton()) {
1471                 title = "動画の保存先(ファイル)";
1472                 field = panel.getVideoSavedFileField();
1473                 isSave = true;
1474                 isDir = false;
1475             } else if (source == panel.getNibrFileChooserButton()) {
1476                 title = "NicoBrowserファイル選択";
1477                 field = panel.getNibrFileField();
1478                 isSave = false;
1479                 isDir = false;
1480             } else {
1481                 return;
1482             }
1483             showSaveDialog(title, field, isSave, isDir);
1484         }
1485     }
1486
1487     private class InputCommentPanelButtonListener implements ActionListener {
1488
1489         public void actionPerformed(ActionEvent e) {
1490             final Object source = e.getSource();
1491             String title;
1492             JTextField field;
1493             boolean isSave;
1494             boolean isDir;
1495             if (source == savePanel.getShowSavingCommentFolderDialogButton()) {
1496                 title = "コメントの保存先(フォルダ)";
1497                 field = savePanel.getCommentSavedFolderField();
1498                 isSave = true;
1499                 isDir = true;
1500             } else if (source == savePanel.getShowSavingCommentFileDialogButton()) {
1501                 title = "コメントの保存先(ファイル)";
1502                 field = savePanel.getCommentSavedFileField();
1503                 isSave = true;
1504                 isDir = false;
1505             } else {
1506                 return;
1507             }
1508             showSaveDialog(title, field, isSave, isDir);
1509         }
1510     }
1511
1512     private class OutputVideoPanelButtonListener implements ActionListener {
1513
1514         public void actionPerformed(ActionEvent e) {
1515             final Object source = e.getSource();
1516             String title;
1517             JTextField field;
1518             boolean isSave;
1519             boolean isDir;
1520             if (source == savePanel.getShowSavingConvertedVideoFolderDialogButton()) {
1521                 title = "コメント付き動画の保存先(フォルダ)";
1522                 field = savePanel.getConvertedVideoSavedFolderField();
1523                 isSave = true;
1524                 isDir = true;
1525             } else if (source == savePanel.getShowSavingConvertedVideoFileDialogButton()) {
1526                 title = "コメント付き動画の保存先(ファイル)";
1527                 field = savePanel.getConvertedVideoSavedFileField();
1528                 isSave = true;
1529                 isDir = false;
1530             } else {
1531                 return;
1532             }
1533             showSaveDialog(title, field, isSave, isDir);
1534         }
1535     }
1536
1537     private class VideoUseRadioButtonListener implements ActionListener {
1538
1539         public void actionPerformed(ActionEvent e) {
1540             Object source = e.getSource();
1541             if (source == videoSaveInfoPanel.getVideoUseNiBrButton()) {
1542                 maskExt();
1543             } else {
1544                 maskBase();
1545             }
1546         }
1547
1548         private void maskBase() {
1549             mask(true);
1550         }
1551
1552         private void maskExt() {
1553             mask(false);
1554         }
1555
1556         private void mask(boolean b) {
1557             final VideoSaveInfoPanel panel = videoSaveInfoPanel;
1558             videoIdField.setEditable(b);
1559             panel.getDelVideoCheckBox().setEnabled(b);
1560
1561             panel.getSaveFolderRadioButton().setEnabled(b);
1562             panel.getVideoSavedFolderField().setEnabled(b);
1563             panel.getShowSavingVideoFolderDialogButton().setEnabled(b);
1564
1565             panel.getSaveFileRadioButton().setEnabled(b);
1566             panel.getVideoSavedFileField().setEnabled(b);
1567             panel.getShowSavingVideoFileDialogButton().setEnabled(b);
1568
1569             panel.getNibrFileField().setEnabled(!b);
1570             panel.getNibrFileChooserButton().setEnabled(!b);
1571         }
1572     }
1573 }
1574
1575 class MainFrame_this_windowAdapter extends WindowAdapter {
1576
1577     private MainFrame adaptee;
1578
1579     MainFrame_this_windowAdapter(MainFrame adaptee) {
1580         this.adaptee = adaptee;
1581     }
1582
1583     @Override
1584     public void windowClosing(WindowEvent e) {
1585         adaptee.this_windowClosing(e);
1586     }
1587 }
1588
1589 class MainFrame_SettingFontPathButton_actionAdapter implements ActionListener {
1590
1591     private MainFrame adaptee;
1592
1593     MainFrame_SettingFontPathButton_actionAdapter(MainFrame adaptee) {
1594         this.adaptee = adaptee;
1595     }
1596
1597     public void actionPerformed(ActionEvent e) {
1598         adaptee.SettingFontPathButton_actionPerformed(e);
1599     }
1600 }
1601
1602 class MainFrame_SettingVhookPathButton_actionAdapter implements ActionListener {
1603
1604     private MainFrame adaptee;
1605
1606     MainFrame_SettingVhookPathButton_actionAdapter(MainFrame adaptee) {
1607         this.adaptee = adaptee;
1608     }
1609
1610     public void actionPerformed(ActionEvent e) {
1611         adaptee.SettingVhookPathButton_actionPerformed(e);
1612     }
1613 }
1614
1615 class MainFrame_SettingFFmpegPathButton_actionAdapter implements ActionListener {
1616
1617     private MainFrame adaptee;
1618
1619     MainFrame_SettingFFmpegPathButton_actionAdapter(MainFrame adaptee) {
1620         this.adaptee = adaptee;
1621     }
1622
1623     public void actionPerformed(ActionEvent e) {
1624         adaptee.SettingFFmpegPathButton_actionPerformed(e);
1625     }
1626 }
1627
1628 class MainFrame_DoButton_actionAdapter implements ActionListener {
1629
1630     private MainFrame adaptee;
1631
1632     MainFrame_DoButton_actionAdapter(MainFrame adaptee) {
1633         this.adaptee = adaptee;
1634     }
1635
1636     public void actionPerformed(ActionEvent e) {
1637         adaptee.DoButton_actionPerformed(e);
1638     }
1639 }
1640
1641 class MainFrame_jMenuFileExit_ActionAdapter implements ActionListener {
1642
1643     MainFrame adaptee;
1644
1645     MainFrame_jMenuFileExit_ActionAdapter(MainFrame adaptee) {
1646         this.adaptee = adaptee;
1647     }
1648
1649     public void actionPerformed(ActionEvent actionEvent) {
1650         adaptee.jMenuFileExit_actionPerformed(actionEvent);
1651     }
1652 }
1653
1654 class MainFrame_jMenuHelpAbout_ActionAdapter implements ActionListener {
1655
1656     MainFrame adaptee;
1657
1658     MainFrame_jMenuHelpAbout_ActionAdapter(MainFrame adaptee) {
1659         this.adaptee = adaptee;
1660     }
1661
1662     public void actionPerformed(ActionEvent actionEvent) {
1663         adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
1664     }
1665 }