OSDN Git Service

ffmpegオプションファイル更新ボタン追加
authoryukihane <yukihane.feather@gmail.com>
Thu, 15 Sep 2011 01:37:57 +0000 (10:37 +0900)
committeryukihane <yukihane.feather@gmail.com>
Thu, 15 Sep 2011 01:37:57 +0000 (10:37 +0900)
frontend/src/saccubus/OptionComboBoxModel.java
frontend/src/yukihane/inqubus/gui/FfmpegParamPanel.java

index 4e2682f..b7d1aa5 100644 (file)
@@ -39,6 +39,11 @@ public final class OptionComboBoxModel extends DefaultComboBoxModel<FFmpegSelect
        private static final FFmpegSelectedItem DEFAULT_ITEM = new FFmpegSelectedItem(
                        0, null, "外部ファイルを用いず、下に直接入力する。");
 
+       public void reload() {
+               final File original_file = getSelectedItem().getFile();
+               reload(original_file);
+       }
+
        public void reload(File original_file) {
                int original_index = -1;
                int index = 1;
index fa14f29..ae03dc6 100644 (file)
@@ -1,9 +1,12 @@
 package yukihane.inqubus.gui;
 
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.io.File;
 import javax.swing.BorderFactory;
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
+import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
 import javax.swing.JLabel;
@@ -125,6 +128,14 @@ class FfmpegParamPanel extends JPanel {
             .addComponent(cbFfmpegOptionKeepAspect)
         );
 
+        final JButton btnReload = new JButton("更新");
+        btnReload.addActionListener(new ActionListener() {
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                mdlFfmpegOption.reload();
+            }
+        });
 
 
         final GroupLayout glFfmpegParam = new GroupLayout(this);
@@ -134,15 +145,23 @@ class FfmpegParamPanel extends JPanel {
             .addGroup(glFfmpegParam.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(glFfmpegParam.createParallelGroup(Alignment.LEADING)
+                    .addGroup(glFfmpegParam.createSequentialGroup()
+                        .addComponent(cmbFfmpegOptionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(ComponentPlacement.UNRELATED)
+                        .addComponent(btnReload)
+                    )
                     .addComponent(pnlFfmpegParamOption, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                    .addComponent(cmbFfmpegOptionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+                )
                 .addContainerGap())
         );
         glFfmpegParam.setVerticalGroup(
             glFfmpegParam.createParallelGroup(Alignment.LEADING)
             .addGroup(glFfmpegParam.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(cmbFfmpegOptionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                .addGroup(glFfmpegParam.createParallelGroup(Alignment.BASELINE)
+                    .addComponent(cmbFfmpegOptionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                    .addComponent(btnReload)
+                )
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addComponent(pnlFfmpegParamOption)
                 .addContainerGap())