OSDN Git Service

作業フォルダ設定用のボタンを追加
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / ConfigDialog.java
1 /*
2  * Properties.java
3  *
4  * Created on 2011/08/20, 16:33:03
5  */
6 package yukihane.inqubus.gui;
7
8 import static javax.swing.GroupLayout.DEFAULT_SIZE;
9 import static javax.swing.GroupLayout.PREFERRED_SIZE;
10
11 import java.awt.event.ActionEvent;
12 import java.awt.event.ActionListener;
13 import java.io.File;
14 import java.util.List;
15 import java.util.logging.Level;
16 import java.util.logging.Logger;
17 import javax.swing.BorderFactory;
18 import javax.swing.ComboBoxModel;
19 import javax.swing.DefaultComboBoxModel;
20 import javax.swing.GroupLayout;
21 import javax.swing.GroupLayout.Alignment;
22 import javax.swing.JButton;
23 import javax.swing.JCheckBox;
24 import javax.swing.JComboBox;
25 import javax.swing.JDialog;
26 import javax.swing.JFileChooser;
27 import javax.swing.JFrame;
28 import javax.swing.JLabel;
29 import javax.swing.JPanel;
30 import javax.swing.JTabbedPane;
31 import javax.swing.JTextField;
32 import javax.swing.LayoutStyle.ComponentPlacement;
33 import javax.swing.UIManager;
34 import javax.swing.UnsupportedLookAndFeelException;
35 import javax.swing.WindowConstants;
36 import org.apache.commons.configuration.ConfigurationException;
37 import yukihane.inqubus.Config;
38
39 /**
40  *
41  * @author yuki
42  */
43 public class ConfigDialog extends JDialog {
44     private static final long serialVersionUID = 1L;
45     private static final Logger logger = Logger.getLogger(ConfigDialog.class.getName());
46
47     /** Creates new form Properties */
48     public ConfigDialog() {
49         this(null);
50     }
51
52     public ConfigDialog(JFrame owner){
53         super(owner);
54
55         final JTabbedPane tabbedPane = new JTabbedPane();
56         final JPanel pnlNetwork = new JPanel();
57         final JPanel pnlAccount = new JPanel();
58         final JLabel lblMail = new JLabel();
59         fldMail = new JTextField();
60         final JLabel lblPassword = new JLabel();
61         fldPassword = new JTextField();
62         final JPanel pnlProxy = new JPanel();
63         cbProxyUse = new JCheckBox();
64         final JLabel lblProxyHost = new JLabel();
65         final JLabel lblProxyPort = new JLabel();
66         fldProxyHost = new JTextField();
67         fldProxyPort = new JTextField();
68         final JPanel pnlFile = new JPanel();
69         final JPanel pnlFileOutput = new JPanel();
70         final JLabel lblOutputDir = new JLabel();
71         final JLabel lblOutputFileNamePattern = new JLabel();
72         fldOutputDir = new JTextField();
73         fldOutputFileNamePattern = new JTextField();
74         cbOutputEnable = new JCheckBox();
75         cbOutputCommentOverlay = new JCheckBox();
76         cbOutputDisplayProgress = new JCheckBox();
77         final JPanel pnlComment = new JPanel();
78         final JPanel pnlCommentStandard = new JPanel();
79         final JLabel lblCommentSize = new JLabel();
80         cbCommentSizeAuto = new JCheckBox();
81         final JLabel lblCommentSizeManual = new JLabel();
82         fldCommentSizeManual = new JTextField();
83         final JLabel lblCommentMinSize = new JLabel();
84         cbCommentMinSizeAuto = new JCheckBox();
85         fldCommentMinSizeManual = new JTextField();
86         final JLabel lblCommentMinSizeManual = new JLabel();
87         final JLabel lblCommentDisplayMax = new JLabel();
88         cbCommentDisplaySizeDefault = new JCheckBox();
89         final JLabel lblCommentDisplayMaxManual = new JLabel();
90         fldCommentDisplaySizeManual = new JTextField();
91         final JPanel pnlCommentAdvanced = new JPanel();
92         final JLabel lblFontPath = new JLabel();
93         cbFontSizeArrangeDisable = new JCheckBox();
94         cbCommentOpaque = new JCheckBox();
95         fldFontPath = new JTextField();
96         final JLabel lblFontIndex = new JLabel();
97         final JLabel lblFontShadow = new JLabel();
98         fldFontIndex = new JTextField();
99         final JPanel pnlFfmpeg = new JPanel();
100         final JPanel jPanel10 = new JPanel();
101         final JLabel lblFfmpegPath = new JLabel();
102         final JLabel lblFfmpegDllPath = new JLabel();
103         fldFfmpegPath = new JTextField();
104         fldFfmpegDllPath = new JTextField();
105         final JPanel pnlNgSetting = new JPanel();
106         final JPanel pnlSearch = new JPanel();
107         final JPanel pnlSearchCache = new JPanel();
108         final JLabel lblSearchCache = new JLabel();
109         fldSearchCache = new JTextField();
110
111         setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
112
113         pnlNetwork.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
114
115         pnlAccount.setBorder(BorderFactory.createTitledBorder("アカウント"));
116
117         lblMail.setText("ID(メールアドレス)");
118
119         lblPassword.setText("パスワード");
120
121         GroupLayout gl_pnlAccount = new GroupLayout(pnlAccount);
122         pnlAccount.setLayout(gl_pnlAccount);
123         gl_pnlAccount.setHorizontalGroup(
124             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
125             .addGroup(gl_pnlAccount.createSequentialGroup()
126                 .addContainerGap()
127                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
128                     .addComponent(lblMail)
129                     .addComponent(lblPassword))
130                 .addPreferredGap(ComponentPlacement.RELATED)
131                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
132                     .addComponent(fldPassword, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)
133                     .addComponent(fldMail, GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE))
134                 .addContainerGap())
135         );
136         gl_pnlAccount.setVerticalGroup(
137             gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.LEADING)
138             .addGroup(gl_pnlAccount.createSequentialGroup()
139                 .addContainerGap()
140                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
141                     .addComponent(lblMail)
142                     .addComponent(fldMail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
143                 .addPreferredGap(ComponentPlacement.RELATED)
144                 .addGroup(gl_pnlAccount.createParallelGroup(GroupLayout.Alignment.BASELINE)
145                     .addComponent(lblPassword)
146                     .addComponent(fldPassword, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
147                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
148         );
149
150         pnlProxy.setBorder(BorderFactory.createTitledBorder("プロキシ"));
151
152         cbProxyUse.setText("プロキシを使用する");
153
154         lblProxyHost.setText("ホスト名");
155
156         lblProxyPort.setText("ポート番号");
157
158         GroupLayout gl_pnlProxy = new GroupLayout(pnlProxy);
159         pnlProxy.setLayout(gl_pnlProxy);
160         gl_pnlProxy.setHorizontalGroup(
161             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
162             .addGroup(gl_pnlProxy.createSequentialGroup()
163                 .addContainerGap()
164                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
165                     .addComponent(cbProxyUse)
166                     .addGroup(gl_pnlProxy.createSequentialGroup()
167                         .addComponent(lblProxyHost)
168                         .addGap(18, 18, 18)
169                         .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
170                     .addGroup(gl_pnlProxy.createSequentialGroup()
171                         .addComponent(lblProxyPort)
172                         .addPreferredGap(ComponentPlacement.RELATED)
173                         .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)))
174                 .addContainerGap(181, Short.MAX_VALUE))
175         );
176         gl_pnlProxy.setVerticalGroup(
177             gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.LEADING)
178             .addGroup(gl_pnlProxy.createSequentialGroup()
179                 .addContainerGap()
180                 .addComponent(cbProxyUse)
181                 .addPreferredGap(ComponentPlacement.RELATED)
182                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
183                     .addComponent(lblProxyHost)
184                     .addComponent(fldProxyHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
185                 .addPreferredGap(ComponentPlacement.RELATED)
186                 .addGroup(gl_pnlProxy.createParallelGroup(GroupLayout.Alignment.BASELINE)
187                     .addComponent(lblProxyPort)
188                     .addComponent(fldProxyPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
189                 .addContainerGap(39, Short.MAX_VALUE))
190         );
191
192         GroupLayout gl_pnlNetwork = new GroupLayout(pnlNetwork);
193         pnlNetwork.setLayout(gl_pnlNetwork);
194         gl_pnlNetwork.setHorizontalGroup(
195             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
196             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNetwork.createSequentialGroup()
197                 .addContainerGap()
198                 .addGroup(gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.TRAILING)
199                     .addComponent(pnlProxy, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
200                     .addComponent(pnlAccount, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
201                 .addContainerGap())
202         );
203         gl_pnlNetwork.setVerticalGroup(
204             gl_pnlNetwork.createParallelGroup(GroupLayout.Alignment.LEADING)
205             .addGroup(gl_pnlNetwork.createSequentialGroup()
206                 .addContainerGap()
207                 .addComponent(pnlAccount, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
208                 .addPreferredGap(ComponentPlacement.RELATED)
209                 .addComponent(pnlProxy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
210                 .addContainerGap(178, Short.MAX_VALUE))
211         );
212
213         tabbedPane.addTab("ネットワーク", pnlNetwork);
214
215         pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
216
217         pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
218
219         pnlFileOutput.setBorder(BorderFactory.createTitledBorder("変換動画"));
220
221         lblOutputDir.setText("保存フォルダ");
222
223         lblOutputFileNamePattern.setText("ファイル名規則");
224
225         btnOutputDir.addActionListener(
226                 new FileChooseAction(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldOutputDir));
227
228         cbOutputEnable.setText("変換");
229
230         cbOutputCommentOverlay.setText("コメント付与");
231
232         cbOutputDisplayProgress.setText("変換中動画表示");
233
234         GroupLayout gl_pnlFileOutput = new GroupLayout(pnlFileOutput);
235         pnlFileOutput.setLayout(gl_pnlFileOutput);
236         gl_pnlFileOutput.setHorizontalGroup(
237             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
238             .addGroup(gl_pnlFileOutput.createSequentialGroup()
239                 .addContainerGap()
240                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
241                     .addComponent(lblOutputFileNamePattern)
242                     .addComponent(lblOutputDir))
243                 .addPreferredGap(ComponentPlacement.RELATED)
244                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
245                     .addGroup(gl_pnlFileOutput.createSequentialGroup()
246                         .addComponent(fldOutputDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
247                         .addPreferredGap(ComponentPlacement.RELATED)
248                         .addComponent(btnOutputDir)
249                         .addContainerGap())
250                     .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileOutput.createSequentialGroup()
251                         .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)
252                         .addPreferredGap(ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
253                         .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
254                             .addComponent(cbOutputDisplayProgress)
255                             .addGroup(gl_pnlFileOutput.createSequentialGroup()
256                                 .addComponent(cbOutputEnable)
257                                 .addPreferredGap(ComponentPlacement.RELATED)
258                                 .addComponent(cbOutputCommentOverlay))))))
259         );
260         gl_pnlFileOutput.setVerticalGroup(
261             gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.LEADING)
262             .addGroup(gl_pnlFileOutput.createSequentialGroup()
263                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
264                     .addComponent(lblOutputDir)
265                     .addComponent(fldOutputDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
266                     .addComponent(btnOutputDir))
267                 .addPreferredGap(ComponentPlacement.RELATED)
268                 .addGroup(gl_pnlFileOutput.createParallelGroup(GroupLayout.Alignment.BASELINE)
269                     .addComponent(lblOutputFileNamePattern)
270                     .addComponent(fldOutputFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
271                     .addComponent(cbOutputCommentOverlay)
272                     .addComponent(cbOutputEnable))
273                 .addPreferredGap(ComponentPlacement.RELATED)
274                 .addComponent(cbOutputDisplayProgress)
275                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
276         );
277
278         final JPanel pnlFileProhibit = new JPanel();
279         pnlFileProhibit.setBorder(BorderFactory.createTitledBorder("禁則文字"));
280         final JLabel lblReplaceFrom = new JLabel("置換対象文字");
281         final JLabel lblReplaceTo = new JLabel("置換後文字");
282
283         final GroupLayout glProhibit = new GroupLayout(pnlFileProhibit);
284         glProhibit.setAutoCreateContainerGaps(true);
285         glProhibit.setAutoCreateGaps(true);
286         pnlFileProhibit.setLayout(glProhibit);
287
288         glProhibit.setHorizontalGroup(glProhibit.createSequentialGroup()
289             .addGroup(glProhibit.createParallelGroup()
290                 .addComponent(lblReplaceFrom)
291                 .addComponent(lblReplaceTo)
292             )
293             .addGroup(glProhibit.createParallelGroup()
294                 .addComponent(fldReplaceFrom)
295                 .addComponent(fldReplaceTo)
296             )
297         );
298
299         glProhibit.setVerticalGroup(glProhibit.createSequentialGroup()
300             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
301                 .addComponent(lblReplaceFrom)
302                 .addComponent(fldReplaceFrom)
303             )
304             .addGroup(glProhibit.createParallelGroup(Alignment.BASELINE)
305                 .addComponent(lblReplaceTo)
306                 .addComponent(fldReplaceTo)
307             )
308         );
309
310         GroupLayout gl_pnlFile = new GroupLayout(pnlFile);
311         pnlFile.setLayout(gl_pnlFile);
312         gl_pnlFile.setHorizontalGroup(
313             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
314             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFile.createSequentialGroup()
315                 .addContainerGap()
316                 .addGroup(gl_pnlFile.createParallelGroup(GroupLayout.Alignment.TRAILING)
317                     .addComponent(pnlFileOutput, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
318                     .addComponent(pnlFileVideo, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
319                     .addComponent(pnlFileComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
320                     .addComponent(pnlFileProhibit, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
321                 )
322                 .addContainerGap())
323         );
324         gl_pnlFile.setVerticalGroup(
325             gl_pnlFile.createParallelGroup(GroupLayout.Alignment.LEADING)
326             .addGroup(gl_pnlFile.createSequentialGroup()
327                 .addContainerGap()
328                 .addComponent(pnlFileVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
329                 .addPreferredGap(ComponentPlacement.RELATED)
330                 .addComponent(pnlFileComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
331                 .addPreferredGap(ComponentPlacement.RELATED)
332                 .addComponent(pnlFileOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
333                 .addPreferredGap(ComponentPlacement.RELATED)
334                 .addComponent(pnlFileProhibit, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
335                 .addContainerGap())
336         );
337
338         tabbedPane.addTab("ファイル", pnlFile);
339
340         pnlCommentStandard.setBorder(BorderFactory.createTitledBorder(""));
341
342         lblCommentSize.setText("再生時間に応じたコメントの取得数");
343
344         cbCommentSizeAuto.setText("自動調整");
345
346         lblCommentSizeManual.setText("手動取得");
347
348         lblCommentMinSize.setText("1分当たりのコメント取得数");
349
350         cbCommentMinSizeAuto.setText("自動調整");
351
352         lblCommentMinSizeManual.setText("手動取得");
353
354         lblCommentDisplayMax.setText("1画面に表示する最大コメント数");
355
356         cbCommentDisplaySizeDefault.setText("標準(30)");
357
358         lblCommentDisplayMaxManual.setText("手動設定");
359
360         GroupLayout gl_pnlCommentStandard = new GroupLayout(pnlCommentStandard);
361         pnlCommentStandard.setLayout(gl_pnlCommentStandard);
362         gl_pnlCommentStandard.setAutoCreateContainerGaps(true);
363         gl_pnlCommentStandard.setAutoCreateGaps(true);
364         gl_pnlCommentStandard.setHorizontalGroup(
365             gl_pnlCommentStandard.createSequentialGroup()
366                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
367                     .addComponent(lblCommentSize)
368                     .addComponent(lblCommentMinSize)
369                     .addComponent(lblCommentDisplayMax))
370                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
371                     .addComponent(cbCommentSizeAuto)
372                     .addComponent(cbCommentMinSizeAuto)
373                     .addComponent(cbCommentDisplaySizeDefault))
374                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
375                     .addComponent(lblCommentSizeManual)
376                     .addComponent(lblCommentMinSizeManual)
377                     .addComponent(lblCommentDisplayMaxManual))
378                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.LEADING)
379                     .addComponent(fldCommentSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
380                     .addComponent(fldCommentMinSizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
381                     .addComponent(fldCommentDisplaySizeManual, 48, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
382         );
383         gl_pnlCommentStandard.setVerticalGroup(
384             gl_pnlCommentStandard.createSequentialGroup()
385                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
386                     .addComponent(lblCommentSize)
387                     .addComponent(cbCommentSizeAuto)
388                     .addComponent(lblCommentSizeManual)
389                     .addComponent(fldCommentSizeManual))
390                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
391                     .addComponent(lblCommentMinSize)
392                     .addComponent(cbCommentMinSizeAuto)
393                     .addComponent(lblCommentMinSizeManual)
394                     .addComponent(fldCommentMinSizeManual))
395                 .addGroup(gl_pnlCommentStandard.createParallelGroup(GroupLayout.Alignment.BASELINE)
396                     .addComponent(lblCommentDisplayMax)
397                     .addComponent(cbCommentDisplaySizeDefault)
398                     .addComponent(lblCommentDisplayMaxManual)
399                     .addComponent(fldCommentDisplaySizeManual))
400         );
401
402         pnlCommentAdvanced.setBorder(BorderFactory.createTitledBorder("高度な設定"));
403
404         lblFontPath.setText("フォントパス");
405
406         cbFontSizeArrangeDisable.setText("フォントサイズ調整を行わない");
407
408         cbCommentOpaque.setText("コメント透明化を行わない");
409
410         final JButton btnFontPath = new JButton("...");
411         btnFontPath.addActionListener(
412                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFontPath));
413
414         lblFontIndex.setText("フォント番号");
415
416         lblFontShadow.setText("影の種類");
417         final ComboBoxModel<String> cbmFontShadow
418                 = new DefaultComboBoxModel<>(new String[]{"0:なし", "1:ニコニコ動画風", "2:右下", "3:囲い込み"});
419         cmbFontShadow.setModel(cbmFontShadow);
420
421         GroupLayout gl_pnlCommentAdvanced = new GroupLayout(pnlCommentAdvanced);
422         pnlCommentAdvanced.setLayout(gl_pnlCommentAdvanced);
423         gl_pnlCommentAdvanced.setHorizontalGroup(
424             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
425             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
426                 .addContainerGap()
427                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
428                     .addComponent(cbCommentOpaque)
429                     .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
430                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
431                             .addComponent(lblFontPath)
432                             .addComponent(lblFontIndex)
433                             .addComponent(lblFontShadow))
434                         .addGap(18, 18, 18)
435                         .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
436                             .addComponent(fldFontPath, GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
437                             .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
438                                 .addComponent(cmbFontShadow, GroupLayout.Alignment.LEADING)
439                                 .addComponent(fldFontIndex, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
440                         .addPreferredGap(ComponentPlacement.RELATED)
441                         .addComponent(btnFontPath))
442                     .addComponent(cbFontSizeArrangeDisable))
443                 .addContainerGap())
444         );
445         gl_pnlCommentAdvanced.setVerticalGroup(
446             gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.LEADING)
447             .addGroup(gl_pnlCommentAdvanced.createSequentialGroup()
448                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
449                     .addComponent(lblFontPath)
450                     .addComponent(fldFontPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
451                     .addComponent(btnFontPath))
452                 .addPreferredGap(ComponentPlacement.RELATED)
453                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
454                     .addComponent(lblFontIndex)
455                     .addComponent(fldFontIndex, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
456                 .addPreferredGap(ComponentPlacement.RELATED)
457                 .addGroup(gl_pnlCommentAdvanced.createParallelGroup(GroupLayout.Alignment.BASELINE)
458                     .addComponent(lblFontShadow)
459                     .addComponent(cmbFontShadow, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
460                 .addPreferredGap(ComponentPlacement.RELATED)
461                 .addComponent(cbFontSizeArrangeDisable)
462                 .addPreferredGap(ComponentPlacement.RELATED)
463                 .addComponent(cbCommentOpaque)
464                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
465         );
466
467         GroupLayout gl_pnlComment = new GroupLayout(pnlComment);
468         pnlComment.setLayout(gl_pnlComment);
469         gl_pnlComment.setHorizontalGroup(
470             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
471             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlComment.createSequentialGroup()
472                 .addContainerGap()
473                 .addGroup(gl_pnlComment.createParallelGroup(GroupLayout.Alignment.TRAILING)
474                     .addComponent(pnlCommentAdvanced, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
475                     .addComponent(pnlCommentStandard, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
476                 .addContainerGap())
477         );
478         gl_pnlComment.setVerticalGroup(
479             gl_pnlComment.createParallelGroup(GroupLayout.Alignment.LEADING)
480             .addGroup(gl_pnlComment.createSequentialGroup()
481                 .addContainerGap()
482                 .addComponent(pnlCommentStandard, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
483                 .addPreferredGap(ComponentPlacement.RELATED)
484                 .addComponent(pnlCommentAdvanced, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
485                 .addContainerGap(168, Short.MAX_VALUE))
486         );
487
488         tabbedPane.addTab("コメント", pnlComment);
489
490         jPanel10.setBorder(BorderFactory.createTitledBorder("ファイルパス"));
491
492         lblFfmpegPath.setText("ffmpeg");
493
494         lblFfmpegDllPath.setText("拡張ライブラリ");
495
496         final JButton btnFfmpegPath = new JButton("...");
497         btnFfmpegPath.addActionListener(
498                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegPath));
499
500         final JButton btnFfmpegDllPath = new JButton("...");
501         btnFfmpegDllPath.addActionListener(
502                 new FileChooseAction(ConfigDialog.this, JFileChooser.FILES_ONLY, fldFfmpegDllPath));
503
504
505         GroupLayout gl_jPanel10 = new GroupLayout(jPanel10);
506         jPanel10.setLayout(gl_jPanel10);
507         gl_jPanel10.setHorizontalGroup(
508             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
509             .addGroup(gl_jPanel10.createSequentialGroup()
510                 .addContainerGap()
511                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
512                     .addComponent(lblFfmpegDllPath)
513                     .addComponent(lblFfmpegPath))
514                 .addPreferredGap(ComponentPlacement.RELATED)
515                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
516                     .addComponent(fldFfmpegDllPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
517                     .addComponent(fldFfmpegPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE))
518                 .addPreferredGap(ComponentPlacement.RELATED)
519                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
520                     .addComponent(btnFfmpegPath, GroupLayout.Alignment.TRAILING)
521                     .addComponent(btnFfmpegDllPath, GroupLayout.Alignment.TRAILING))
522                 .addContainerGap())
523         );
524         gl_jPanel10.setVerticalGroup(
525             gl_jPanel10.createParallelGroup(GroupLayout.Alignment.LEADING)
526             .addGroup(gl_jPanel10.createSequentialGroup()
527                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
528                     .addComponent(lblFfmpegPath)
529                     .addComponent(fldFfmpegPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
530                     .addComponent(btnFfmpegPath))
531                 .addPreferredGap(ComponentPlacement.RELATED)
532                 .addGroup(gl_jPanel10.createParallelGroup(GroupLayout.Alignment.BASELINE)
533                     .addComponent(lblFfmpegDllPath)
534                     .addComponent(fldFfmpegDllPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
535                     .addComponent(btnFfmpegDllPath))
536                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
537         );
538
539         pnlFfmpegParam.setBorder(BorderFactory.createTitledBorder("ffmpegパラメータ"));
540
541
542
543         GroupLayout gl_pnlFfmpeg = new GroupLayout(pnlFfmpeg);
544         pnlFfmpeg.setLayout(gl_pnlFfmpeg);
545         gl_pnlFfmpeg.setHorizontalGroup(
546             gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
547             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFfmpeg.createSequentialGroup()
548                 .addContainerGap()
549                 .addGroup(gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.TRAILING)
550                     .addComponent(pnlFfmpegParam, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
551                     .addComponent(jPanel10, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
552                 .addContainerGap())
553         );
554         gl_pnlFfmpeg.setVerticalGroup(
555             gl_pnlFfmpeg.createParallelGroup(GroupLayout.Alignment.LEADING)
556             .addGroup(gl_pnlFfmpeg.createSequentialGroup()
557                 .addContainerGap()
558                 .addComponent(jPanel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
559                 .addPreferredGap(ComponentPlacement.RELATED)
560                 .addComponent(pnlFfmpegParam, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
561                 .addContainerGap())
562         );
563
564         tabbedPane.addTab("ffmpeg", pnlFfmpeg);
565
566         pnlNgWord.setBorder(BorderFactory.createTitledBorder("NGワード"));
567         pnlNgId.setBorder(BorderFactory.createTitledBorder("NGID"));
568
569         GroupLayout gl_pnlNgSetting = new GroupLayout(pnlNgSetting);
570         pnlNgSetting.setLayout(gl_pnlNgSetting);
571         gl_pnlNgSetting.setHorizontalGroup(
572             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
573             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlNgSetting.createSequentialGroup()
574                 .addContainerGap()
575                 .addGroup(gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.TRAILING)
576                     .addComponent(pnlNgId, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
577                     .addComponent(pnlNgWord, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
578                 .addContainerGap())
579         );
580         gl_pnlNgSetting.setVerticalGroup(
581             gl_pnlNgSetting.createParallelGroup(GroupLayout.Alignment.LEADING)
582             .addGroup(gl_pnlNgSetting.createSequentialGroup()
583                 .addContainerGap()
584                 .addComponent(pnlNgWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
585                 .addPreferredGap(ComponentPlacement.RELATED)
586                 .addComponent(pnlNgId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
587                 .addContainerGap())
588         );
589
590         tabbedPane.addTab("NG設定", pnlNgSetting);
591
592         pnlSearchVideo.setBorder(BorderFactory.createTitledBorder("動画検索対象フォルダ"));
593         pnlSearchComment.setBorder(BorderFactory.createTitledBorder("コメント検索対象フォルダ"));
594
595         pnlSearchCache.setBorder(BorderFactory.createEtchedBorder());
596
597         lblSearchCache.setText("キャッシュ更新(秒)");
598
599         GroupLayout gl_pnlSearchCache = new GroupLayout(pnlSearchCache);
600         pnlSearchCache.setLayout(gl_pnlSearchCache);
601         gl_pnlSearchCache.setHorizontalGroup(
602             gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.LEADING)
603             .addGroup(gl_pnlSearchCache.createSequentialGroup()
604                 .addContainerGap()
605                 .addComponent(lblSearchCache)
606                 .addPreferredGap(ComponentPlacement.RELATED)
607                 .addComponent(fldSearchCache, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
608                 .addContainerGap(269, Short.MAX_VALUE))
609         );
610         gl_pnlSearchCache.setVerticalGroup(
611             gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.LEADING)
612             .addGroup(gl_pnlSearchCache.createSequentialGroup()
613                 .addContainerGap()
614                 .addGroup(gl_pnlSearchCache.createParallelGroup(GroupLayout.Alignment.BASELINE)
615                     .addComponent(lblSearchCache)
616                     .addComponent(fldSearchCache, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
617                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
618         );
619
620         GroupLayout gl_pnlSearch = new GroupLayout(pnlSearch);
621         pnlSearch.setLayout(gl_pnlSearch);
622         gl_pnlSearch.setHorizontalGroup(
623             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
624             .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlSearch.createSequentialGroup()
625                 .addContainerGap()
626                 .addGroup(gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.TRAILING)
627                     .addComponent(pnlSearchCache, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
628                     .addComponent(pnlSearchComment, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
629                     .addComponent(pnlSearchVideo, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
630                 .addContainerGap())
631         );
632         gl_pnlSearch.setVerticalGroup(
633             gl_pnlSearch.createParallelGroup(GroupLayout.Alignment.LEADING)
634             .addGroup(gl_pnlSearch.createSequentialGroup()
635                 .addContainerGap()
636                 .addComponent(pnlSearchVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
637                 .addPreferredGap(ComponentPlacement.RELATED)
638                 .addComponent(pnlSearchComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
639                 .addPreferredGap(ComponentPlacement.RELATED)
640                 .addComponent(pnlSearchCache, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
641                 .addContainerGap(27, Short.MAX_VALUE))
642         );
643
644         tabbedPane.addTab("検索", pnlSearch);
645
646         final JButton btnOk = new JButton("保存");
647         btnOk.addActionListener(new ActionListener() {
648
649             @Override
650             public void actionPerformed(ActionEvent e) {
651                 saveConfig();
652                 dispose();
653             }
654         });
655         final JButton btnCancel = new JButton("取消");
656         btnCancel.addActionListener(new ActionListener() {
657
658             @Override
659             public void actionPerformed(ActionEvent e) {
660                 dispose();
661             }
662         });
663         final JPanel pnlButton = new JPanel();
664
665         final GroupLayout glButton = new GroupLayout(pnlButton);
666         pnlButton.setLayout(glButton);
667         glButton.setHorizontalGroup(glButton.createSequentialGroup()
668             .addPreferredGap(ComponentPlacement.UNRELATED, PREFERRED_SIZE, Short.MAX_VALUE)
669             .addComponent(btnOk)
670             .addPreferredGap(ComponentPlacement.UNRELATED)
671             .addComponent(btnCancel)
672             .addContainerGap()
673         );
674         glButton.setVerticalGroup(glButton.createSequentialGroup()
675             .addGroup(glButton.createParallelGroup(Alignment.BASELINE)
676                 .addComponent(btnOk)
677                 .addComponent(btnCancel)
678             )
679         );
680
681         GroupLayout layout = new GroupLayout(getContentPane());
682         layout.setAutoCreateContainerGaps(true);
683         getContentPane().setLayout(layout);
684         layout.setHorizontalGroup(
685             layout.createParallelGroup(GroupLayout.Alignment.LEADING)
686             .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE)
687             .addComponent(pnlButton)
688         );
689         layout.setVerticalGroup(
690             layout.createSequentialGroup()
691                 .addComponent(tabbedPane,GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
692                 .addComponent(pnlButton)
693         );
694
695         final JLabel lblSystemThreadDownload = new JLabel("ダウンロードスレッド数");
696         final JLabel lblSystemWaitDownload = new JLabel("ダウンロード開始最小間隔(秒)");
697         final JLabel lblSystemThreadConvert = new JLabel("変換スレッド数");
698         final JLabel lblSystemTempDir = new JLabel("作業フォルダ");
699         final JButton btnSystemTempDir = new JButton("...");
700         btnSystemTempDir.addActionListener(
701                 new FileChooseAction(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
702
703         final JPanel pnlSystemGeneral = new JPanel();
704         pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
705         final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
706         glSystemGenegal.setAutoCreateGaps(true);
707         glSystemGenegal.setAutoCreateContainerGaps(true);
708         pnlSystemGeneral.setLayout(glSystemGenegal);
709
710         glSystemGenegal.setHorizontalGroup(glSystemGenegal.createParallelGroup()
711             .addGroup(glSystemGenegal.createSequentialGroup()
712                 .addGroup(glSystemGenegal.createParallelGroup()
713                     .addComponent(lblSystemThreadDownload)
714                     .addComponent(lblSystemWaitDownload)
715                     .addComponent(lblSystemThreadConvert))
716                 .addGroup(glSystemGenegal.createParallelGroup()
717                     .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
718                     .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
719                     .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 40, PREFERRED_SIZE)
720                 )
721             )
722             .addGroup(glSystemGenegal.createSequentialGroup()
723                 .addComponent(lblSystemTempDir)
724                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, 400, Short.MAX_VALUE)
725                 .addComponent(btnSystemTempDir)
726                 )
727             );
728
729         glSystemGenegal.setVerticalGroup(glSystemGenegal.createSequentialGroup()
730             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
731                 .addComponent(lblSystemThreadDownload)
732                 .addComponent(fldSystemThreadDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
733             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
734                 .addComponent(lblSystemWaitDownload)
735                 .addComponent(fldSystemWaitDownload, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
736             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
737                 .addComponent(lblSystemThreadConvert)
738                 .addComponent(fldSystemThreadConvert, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE))
739             .addGroup(glSystemGenegal.createParallelGroup(Alignment.BASELINE)
740                 .addComponent(lblSystemTempDir)
741                 .addComponent(fldSystemTempDir, DEFAULT_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
742                 .addComponent(btnSystemTempDir)
743             )
744         );
745
746         final JPanel pnlSystem = new JPanel();
747         pnlSystem.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
748         final GroupLayout glSystem = new GroupLayout(pnlSystem);
749         glSystem.setAutoCreateGaps(true);
750         glSystem.setAutoCreateContainerGaps(true);
751         pnlSystem.setLayout(glSystem);
752
753         glSystem.setHorizontalGroup(glSystem.createParallelGroup()
754             .addComponent(pnlSystemGeneral));
755
756         glSystem.setVerticalGroup(glSystem.createSequentialGroup()
757             .addComponent(pnlSystemGeneral));
758
759         tabbedPane.add("システム", pnlSystem);
760
761         pack();
762         setMinimumSize(getSize());
763         loadConfig();
764     }
765
766     /**
767      * @param args the command line arguments
768      */
769     public static void main(String args[]) {
770         /* Set the Nimbus look and feel */
771         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
772          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
773          */
774         try {
775             for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
776                 if ("Nimbus".equals(info.getName())) {
777                     UIManager.setLookAndFeel(info.getClassName());
778                     break;
779                 }
780             }
781         } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
782             java.util.logging.Logger.getLogger(ConfigDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
783         }
784
785         /* Create and display the form */
786         java.awt.EventQueue.invokeLater(new Runnable() {
787
788             @Override
789             public void run() {
790                 new ConfigDialog().setVisible(true);
791             }
792         });
793     }
794     // Variables declaration - do not modify//GEN-BEGIN:variables
795
796     // ネットワーク
797     // ネットワーク - アカウント
798     private final JTextField fldMail;
799     private final JTextField fldPassword;
800     // ネットワーク - プロキシ
801     private final JCheckBox cbProxyUse;
802     private final JTextField fldProxyHost;
803     private final JTextField fldProxyPort;
804     // ファイル
805     // ファイル - 動画
806     private final DownloadLocationPanel pnlFileVideo = new DownloadLocationPanel();
807     // ファイル - コメント
808     private final DownloadLocationPanel pnlFileComment = new DownloadLocationPanel();
809     // ファイル - 変換動画
810     private final JTextField fldOutputDir;
811     private final JTextField fldOutputFileNamePattern;
812     private final JButton btnOutputDir = new JButton("...");
813     private final JCheckBox cbOutputEnable;
814     private final JCheckBox cbOutputCommentOverlay;
815     private final JCheckBox cbOutputDisplayProgress;
816     // ファイル - 禁則文字
817     private final JTextField fldReplaceFrom = new JTextField();
818     private final JTextField fldReplaceTo = new JTextField();
819     // コメント
820     // コメント
821     private final JCheckBox cbCommentSizeAuto;
822     private final JTextField fldCommentSizeManual;
823     private final JCheckBox cbCommentMinSizeAuto;
824     private final JTextField fldCommentMinSizeManual;
825     private final JCheckBox cbCommentDisplaySizeDefault;
826     private final JTextField fldCommentDisplaySizeManual;
827     // コメント - 高度な設定
828     private final JTextField fldFontPath;
829     private final JTextField fldFontIndex;
830     private final JComboBox<String> cmbFontShadow = new JComboBox<>();
831     private final JCheckBox cbFontSizeArrangeDisable;
832     private final JCheckBox cbCommentOpaque;
833     // ffmpeg
834     // ffmpeg - ファイルパス
835     private final JTextField fldFfmpegPath;
836     private final JTextField fldFfmpegDllPath;
837     // ffmpeg - ffmpegパラメータ
838     private final FfmpegParamPanel pnlFfmpegParam = new FfmpegParamPanel();
839     // NG設定
840     // NG設定 - NGワード
841     private final NgRegisterPanel pnlNgWord = new NgRegisterPanel();
842     // NG設定 - NGID
843     private final NgRegisterPanel pnlNgId = new NgRegisterPanel();
844     // 検索
845     // 検索 - 動画検索対象フォルダ
846     private final DirectoryRegisterPanel pnlSearchVideo = new DirectoryRegisterPanel();
847     // 検索 - コメント検索対象フォルダ
848     private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
849     // 検索 - キャッシュ更新(秒)
850     private final JTextField fldSearchCache;
851     // システム
852     private final JTextField fldSystemThreadDownload = new JTextField();
853     private final JTextField fldSystemWaitDownload = new JTextField();
854     private final JTextField fldSystemThreadConvert = new JTextField();
855     private final JTextField fldSystemTempDir = new JTextField();
856
857
858     // End of variables declaration//GEN-END:variables
859
860     private void loadConfig() {
861         final Config p = Config.INSTANCE;
862
863         /*
864          * ネットワーク - アカウント
865          */
866         fldMail.setText(p.getId());
867         fldPassword.setText(p.getPassword());
868
869         /*
870          * ネットワーク - プロキシ
871          */
872         cbProxyUse.setSelected(p.getProxyUse());
873         fldProxyHost.setText(p.getProxyHost());
874         fldProxyPort.setText(p.getProxyPort());
875
876         /*
877          * ファイル - 動画
878          */
879         pnlFileVideo.fldDir.setText(p.getVideoDir());
880         pnlFileVideo.fldFileNamePattern.setText(p.getVideoFileNamePattern());
881         pnlFileVideo.cbLocal.setSelected(p.getVideoUseLocal());
882
883         /*
884          * ファイル - コメント
885          */
886         pnlFileComment.fldDir.setText(p.getCommentDir());
887         pnlFileComment.fldFileNamePattern.setText(p.getCommentFileNamePattern());
888         pnlFileComment.cbLocal.setSelected(p.getCommentUseLocal());
889
890         /*
891          * ファイル - 変換動画
892          */
893         fldOutputDir.setText(p.getOutputDir());
894         fldOutputFileNamePattern.setText(p.getOutputFileNamePattern());
895         cbOutputEnable.setSelected(p.getOutputEnable());
896         cbOutputCommentOverlay.setSelected(p.getOutputCommentOverlay());
897         cbOutputDisplayProgress.setSelected(p.getOutputDisplayProgress());
898
899         /*
900          * ファイル - 禁則文字
901          */
902         fldReplaceFrom.setText(p.getReplaceFrom());
903         fldReplaceTo.setText(p.getReplaceTo());
904
905         /**
906          * コメント
907          */
908         cbCommentSizeAuto.setSelected(p.getCommentSizeAutosize());
909         fldCommentSizeManual.setText(p.getCommentSizeManual());
910         cbCommentMinSizeAuto.setSelected(p.getCommentMinSizeAutosize());
911         fldCommentSizeManual.setText(p.getCommentMinSizeManual());
912         cbCommentDisplaySizeDefault.setSelected(p.getCommentDisplaySizeDefault());
913         fldCommentDisplaySizeManual.setText(p.getCommentDisplaySizeManual());
914
915         /**
916          * コメント - 高度な設定
917          */
918         fldFontPath.setText(p.getFontPath());
919         fldFontIndex.setText(p.getFontIndex());
920         cmbFontShadow.setSelectedIndex(p.getFontShadow());
921         cbFontSizeArrangeDisable.setSelected(p.getFontSizeArrangeDisable());
922         cbCommentOpaque.setSelected(p.getCommentOpaque());
923
924         /*
925          * ffmpeg - ファイルパス
926          */
927         fldFfmpegPath.setText(p.getFfmpegPath());
928         fldFfmpegDllPath.setText(p.getFfmpegDllPath());
929
930         /*
931          * ffmpeg - ffmpegパラメータ
932          */
933         pnlFfmpegParam.init(p);
934
935         /*
936          * NG 設定
937          */
938         final List<String> ngWords = p.getNgWords();
939         pnlNgWord.init(ngWords);
940         final List<String> ngIds = p.getNgIds();
941         pnlNgId.init(ngIds);
942
943         /*
944          * 検索
945          */
946         pnlSearchVideo.init(p.getSearchVideoDirs());
947         pnlSearchComment.init(p.getSearchCommentDirs());
948
949         /*
950          * システム
951          */
952         fldSystemThreadDownload.setText(Integer.toString(p.getSystemDownloadThread()));
953         fldSystemWaitDownload.setText(Integer.toString(p.getSystemDownloadWait()));
954         fldSystemThreadConvert.setText(Integer.toString(p.getSystemConvertThread()));
955         fldSystemTempDir.setText(p.getSystemTempDir());
956     }
957
958     private void saveConfig() {
959         final Config p = Config.INSTANCE;
960
961         /*
962          * ネットワーク - アカウント
963          */
964
965         p.setId(fldMail.getText());
966         p.setPassword(fldPassword.getText());
967
968         /*
969          * ネットワーク - プロキシ
970          */
971         p.setProxyUse(cbProxyUse.isSelected());
972         p.setProxyHost(fldProxyHost.getText());
973         p.setProxyPort(fldProxyPort.getText());
974
975         /*
976          * ファイル - 動画
977          */
978         p.setVideoDir(pnlFileVideo.fldDir.getText());
979         p.setVideoFileNamePattern(pnlFileVideo.fldFileNamePattern.getText());
980         p.setVideoUseLocal(pnlFileVideo.cbLocal.isSelected());
981
982         /*
983          * ファイル - コメント
984          */
985         p.setCommentDir(pnlFileComment.fldDir.getText());
986         p.setCommentFileNamePattern(pnlFileComment.fldFileNamePattern.getText());
987         p.setCommentUseLocal(pnlFileComment.cbLocal.isSelected());
988
989         /*
990          * ファイル - 変換動画
991          */
992         p.setOutputDir(fldOutputDir.getText());
993         p.setOutputFileNamePattern(fldOutputFileNamePattern.getText());
994         p.setOutputEnable(cbOutputEnable.isSelected());
995         p.setOutputCommentOverlay(cbOutputCommentOverlay.isSelected());
996         p.setOutputDisplayProgress(cbOutputDisplayProgress.isSelected());
997
998         /*
999          * ファイル - 禁則文字
1000          */
1001         p.setReplaceFrom(fldReplaceFrom.getText());
1002         p.setReplaceTo(fldReplaceTo.getText());
1003
1004         /*
1005          * コメント
1006          */
1007         p.setCommentSizeAutosize(cbCommentSizeAuto.isSelected());
1008         p.setCommentSizeManual(fldCommentSizeManual.getText());
1009         p.setCommentMinSizeAutosize(cbCommentMinSizeAuto.isSelected());
1010         p.setCommentMinSizeManual(fldCommentSizeManual.getText());
1011         p.setCommentDisplaySizeDefault(cbCommentDisplaySizeDefault.isSelected());
1012         p.setCommentDisplaySizeManual(fldCommentDisplaySizeManual.getText());
1013
1014         /**
1015          * コメント - 高度な設定
1016          */
1017         p.setFontPath(fldFontPath.getText());
1018         p.setFontIndex(fldFontIndex.getText());
1019         p.setFontShadow(cmbFontShadow.getSelectedIndex());
1020         p.setFontSizeArrangeDisable(cbFontSizeArrangeDisable.isSelected());
1021         p.setCommentOpaque(cbCommentOpaque.isSelected());
1022
1023         /*
1024          * ffmpeg - ファイルパス
1025          */
1026         p.setFfmpegPath(fldFfmpegPath.getText());
1027         p.setFfmpegDllPath(fldFfmpegDllPath.getText());
1028
1029         /*
1030          * ffmpeg - ffmpegパラメータ
1031          */
1032         final File fileFfmpegOption = pnlFfmpegParam.mdlFfmpegOption.getSelectedFile();
1033         p.setFfmpegOptionFile(fileFfmpegOption != null ? fileFfmpegOption.getPath() : null);
1034         p.setFfmpegExtension(pnlFfmpegParam.fldFfmpegOptionExtension.getText());
1035         p.setFfmpegMainOption(pnlFfmpegParam.fldFfmpegOptionMain.getText());
1036         p.setFfmpegInOption(pnlFfmpegParam.fldFfmpegOptionIn.getText());
1037         p.setFfmpegOutOption(pnlFfmpegParam.fldFfmpegOptionOut.getText());
1038         p.setFfmpegAvOption(pnlFfmpegParam.fldFfmpegOptionAv.getText());
1039         p.setFfmpegResizeEnable(pnlFfmpegParam.cbFfmpegOptionResize.isSelected());
1040         p.setFfmpegResizeWidth(pnlFfmpegParam.fldFfmpegOptionResizeWidth.getText());
1041         p.setFfmpegResizeHeight(pnlFfmpegParam.fldFfmpegOptionResizeHeight.getText());
1042         p.setFfmpegKeepAspect(pnlFfmpegParam.cbFfmpegOptionKeepAspect.isSelected());
1043
1044         /*
1045          * NG 設定
1046          */
1047         p.setNgWords(pnlNgWord.getAllElements());
1048         p.setNgIds(pnlNgId.getAllElements());
1049
1050         /*
1051          * 検索
1052          */
1053         p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
1054         p.setSearchCommentDirs(pnlSearchComment.getAllElements());
1055
1056         /*
1057          * システム
1058          */
1059         p.setSystemDownloadThread(Integer.parseInt(fldSystemThreadDownload.getText()));
1060         p.setSystemDownloadWait(Integer.parseInt(fldSystemWaitDownload.getText()));
1061         p.setSystemConvertThread(Integer.parseInt(fldSystemThreadConvert.getText()));
1062         p.setSystemTempDir(fldSystemTempDir.getText());
1063
1064         try {
1065             p.save();
1066         } catch (ConfigurationException ex) {
1067             logger.log(Level.SEVERE, "コンフィグファイル保存に失敗", ex);
1068         }
1069     }
1070 }
1071
1072 class DownloadLocationPanel extends JPanel {
1073     final JTextField fldDir = new JTextField();
1074     final JTextField fldFileNamePattern = new JTextField();
1075     final JCheckBox cbLocal = new JCheckBox("local");
1076
1077     DownloadLocationPanel(){
1078         super();
1079
1080         final JLabel lblVideoDir = new JLabel("保存フォルダ");
1081         final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
1082
1083         final JButton btnDir = new JButton("...");
1084         btnDir.addActionListener(
1085                 new FileChooseAction(DownloadLocationPanel.this, JFileChooser.DIRECTORIES_ONLY, fldDir));
1086
1087         final GroupLayout gl = new GroupLayout(this);
1088         setLayout(gl);
1089         gl.setHorizontalGroup(
1090             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1091             .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1092                 .addContainerGap()
1093                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1094                     .addComponent(lblVideoFileNamepattern)
1095                     .addComponent(lblVideoDir))
1096                 .addPreferredGap(ComponentPlacement.RELATED)
1097                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1098                     .addGroup(gl.createSequentialGroup()
1099                         .addComponent(fldDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
1100                         .addPreferredGap(ComponentPlacement.RELATED)
1101                         .addComponent(btnDir))
1102                     .addGroup(GroupLayout.Alignment.TRAILING, gl.createSequentialGroup()
1103                         .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
1104                         .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
1105                         .addComponent(cbLocal)))
1106                 .addContainerGap())
1107         );
1108         gl.setVerticalGroup(
1109             gl.createParallelGroup(GroupLayout.Alignment.LEADING)
1110             .addGroup(gl.createSequentialGroup()
1111                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1112                     .addComponent(lblVideoDir)
1113                     .addComponent(fldDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1114                     .addComponent(btnDir))
1115                 .addPreferredGap(ComponentPlacement.RELATED)
1116                 .addGroup(gl.createParallelGroup(GroupLayout.Alignment.BASELINE)
1117                     .addComponent(lblVideoFileNamepattern)
1118                     .addComponent(fldFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
1119                     .addComponent(cbLocal))
1120                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1121         );
1122
1123     }
1124 }