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