OSDN Git Service

ローカル動画/コメントファイル選択ダイアログ起動用ボタンを復活
authoryukihane <yukihane.feather@gmail.com>
Fri, 2 Sep 2011 14:13:16 +0000 (23:13 +0900)
committeryukihane <yukihane.feather@gmail.com>
Fri, 9 Sep 2011 11:40:52 +0000 (20:40 +0900)
frontend/src/yukihane/inqubus/gui/MainFrame.java

index 53fbfcf..0ad9888 100644 (file)
@@ -41,6 +41,7 @@ import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JMenu;
@@ -156,6 +157,8 @@ public class MainFrame extends JFrame {
         cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
         fldVideo = new JTextField();
         fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
+        btnVideo.addActionListener(
+                new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldVideo));
         final JLabel lblComment = new JLabel();
 
         fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
@@ -191,6 +194,8 @@ public class MainFrame extends JFrame {
         });
         fldComment = new JTextField();
         fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
+        btnComment.addActionListener(
+                new FileChooseAction(MainFrame.this, JFileChooser.FILES_ONLY, fldComment));
         final JLabel lblOutput = new JLabel();
         cbOutputEnable = new JCheckBox();
         fldOutput = new JTextField();
@@ -320,6 +325,10 @@ public class MainFrame extends JFrame {
                     .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                     .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                 )
+                .addGroup(glInputMain.createParallelGroup()
+                    .addComponent(btnVideo)
+                    .addComponent(btnComment)
+                )
                 .addContainerGap()
             )
         );
@@ -338,13 +347,17 @@ public class MainFrame extends JFrame {
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblVideo)
+                    .addComponent(cbVideoLocal)
                     .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                    .addComponent(cbVideoLocal))
+                    .addComponent(btnVideo)
+                )
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblComment)
+                    .addComponent(cbCommentLocal)
                     .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                    .addComponent(cbCommentLocal))
+                    .addComponent(btnComment)
+                )
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
                     .addComponent(lblOutput)
@@ -600,18 +613,23 @@ public class MainFrame extends JFrame {
 
         final ItemSelectable source = evt.getItemSelectable();
 
+        JButton button;
         JTextField field;
         File dir;
         if (source == cbVideoLocal) {
+            button = btnVideo;
             field = fldVideo;
             dir = new File(p.getVideoDir());
         } else {
+            button = btnComment;
             field = fldComment;
             dir = new File(p.getCommentDir());
         }
 
         final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
 
+        button.setEnabled(useLocal);
+
         String text;
         if (useLocal) {
             final File f = searchFileMatchId(dir, fldId.getText());
@@ -671,8 +689,10 @@ public class MainFrame extends JFrame {
     private final JTextField fldBackLog = new JTextField();
     private final JCheckBox cbVideoLocal;
     private final JTextField fldVideo;
+    private final JButton btnVideo = new JButton("...");
     private final JCheckBox cbCommentLocal;
     private final JTextField fldComment;
+    private final JButton btnComment = new JButton("...");
     private final JCheckBox cbOutputEnable;
     private final JTextField fldOutput;
     // 入力領域 - ffmpeg
@@ -697,17 +717,19 @@ public class MainFrame extends JFrame {
         fldBackLog.setEnabled(false);
         cbBackLog.setEnabled(true);
 
-        final boolean movieLocal = p.getVideoUseLocal();
-        cbVideoLocal.setSelected(movieLocal);
-        if (!movieLocal) {
+        final boolean videoLocal = p.getVideoUseLocal();
+        cbVideoLocal.setSelected(videoLocal);
+        if (!videoLocal) {
             fldVideo.setText(p.getVideoFileNamePattern());
         }
+        btnVideo.setEnabled(videoLocal);
 
         final boolean commentLocal = p.getCommentUseLocal();
         cbCommentLocal.setSelected(commentLocal);
         if (!commentLocal) {
             fldComment.setText(p.getCommentFileNamePattern());
         }
+        btnComment.setEnabled(commentLocal);
 
         final boolean convert = p.getOutputEnable();
         cbOutputEnable.setSelected(convert);