OSDN Git Service

ffmpeg設定GUIレイアウトをGroupLayoutを使って書き直し
authoryukihane <yukihane.feather@gmail.com>
Mon, 1 Aug 2011 20:01:52 +0000 (05:01 +0900)
committeryukihane <yukihane.feather@gmail.com>
Mon, 1 Aug 2011 20:01:52 +0000 (05:01 +0900)
自動リサイズ用コンポーネント追加

frontend/src/saccubus/MainFrame.java

index d520e8c..cef745a 100644 (file)
@@ -20,6 +20,7 @@ import java.awt.event.WindowEvent;
 import java.io.File;
 import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;
+import javax.swing.GroupLayout;
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JComboBox;
@@ -36,6 +37,7 @@ import javax.swing.JRadioButton;
 import javax.swing.JTabbedPane;
 import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
+import javax.swing.border.BevelBorder;
 import nicobrowser.entity.NicoContent;
 import org.apache.commons.lang.StringUtils;
 import saccubus.ConvertStopFlag.State;
@@ -277,43 +279,6 @@ public class MainFrame extends JFrame {
         gridBagConstraints58.fill = GridBagConstraints.HORIZONTAL;
         gridBagConstraints58.gridy = 0;
 
-
-        final GridBagConstraints gbcFFmpegOptionComboBoxPanel = new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
-
-        final Insets ffmpegOptionInsets = new Insets(0, 0, 5, 5);
-
-        final GridBagConstraints gbcExtOptionLabel = new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
-                GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcExtOptionField = new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcMainOptionLabel = new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
-                GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcMainOptionField = new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcInputOptionLabel = new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0,
-                GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcInputOptionField = new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcOutputOptionLabel = new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
-                GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcOutputOptionField = new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcAvfilterOptionLabel = new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0,
-                GridBagConstraints.WEST, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-        final GridBagConstraints gbcAvfilterOptionField = new GridBagConstraints(1, 6, 1, 1, 1.0, 0.0,
-                GridBagConstraints.CENTER, GridBagConstraints.BOTH, ffmpegOptionInsets, 0, 0);
-
-
         GridBagConstraints gridBagConstraints54 = new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER,
                 GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);
         gridBagConstraints54.gridwidth = 3;
@@ -452,17 +417,58 @@ public class MainFrame extends JFrame {
                 GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
         PathSettingPanel.add(VhookPathLabel, gridBagConstraints54);
 
-        FFmpegSettingPanel.add(getFFmpegOptionComboBoxPanel(), gbcFFmpegOptionComboBoxPanel);
-        FFmpegSettingPanel.add(extOptionLabel, gbcExtOptionLabel);
-        FFmpegSettingPanel.add(extOptionField, gbcExtOptionField);
-        FFmpegSettingPanel.add(mainOptionField, gbcMainOptionField);
-        FFmpegSettingPanel.add(mainOptionLabel, gbcMainOptionLabel);
-        FFmpegSettingPanel.add(inputOptionField, gbcInputOptionField);
-        FFmpegSettingPanel.add(inputOptionLabel, gbcInputOptionLabel);
-        FFmpegSettingPanel.add(outputOptionField, gbcOutputOptionField);
-        FFmpegSettingPanel.add(outputOptionLabel, gbcOutputOptionLabel);
-        FFmpegSettingPanel.add(avfilterOptionLabel, gbcAvfilterOptionLabel);
-        FFmpegSettingPanel.add(avfilterOptionField, gbcAvfilterOptionField);
+
+        final GroupLayout layout = new GroupLayout(FFmpegSettingPanel);
+        FFmpegSettingPanel.setLayout(layout);
+
+        layout.setHorizontalGroup(layout.createParallelGroup()
+                .addComponent(getFFmpegOptionComboBoxPanel())
+                .addGroup(layout.createSequentialGroup()
+                    .addGroup(layout.createParallelGroup()
+                        .addComponent(extOptionLabel)
+                        .addComponent(mainOptionLabel)
+                        .addComponent(inputOptionLabel)
+                        .addComponent(outputOptionLabel))
+                    .addGroup(layout.createParallelGroup()
+                        .addComponent(extOptionField)
+                        .addComponent(mainOptionField)
+                        .addComponent(inputOptionField)
+                        .addComponent(outputOptionField)))
+                .addGroup(layout.createParallelGroup()
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(resizeCheckBox)
+                        .addComponent(resizeWidthLabel)
+                        .addComponent(resizeWidthField)
+                        .addComponent(resizeHeightLabel)
+                        .addComponent(resizeHeigitField)))
+                    .addComponent(adjustRatioCheckBox)
+                    .addComponent(padCheckBox)
+                );
+
+        layout.setVerticalGroup(layout.createSequentialGroup()
+                .addComponent(getFFmpegOptionComboBoxPanel())
+                .addGroup(layout.createParallelGroup()
+                    .addComponent(extOptionLabel)
+                    .addComponent(extOptionField))
+                .addGroup(layout.createParallelGroup()
+                    .addComponent(mainOptionLabel)
+                    .addComponent(mainOptionField))
+                .addGroup(layout.createParallelGroup()
+                    .addComponent(inputOptionLabel)
+                    .addComponent(inputOptionField))
+                .addGroup(layout.createParallelGroup()
+                    .addComponent(outputOptionLabel)
+                    .addComponent(outputOptionField))
+                .addGroup(layout.createSequentialGroup()
+                    .addGroup(layout.createParallelGroup()
+                        .addComponent(resizeCheckBox)
+                        .addComponent(resizeWidthLabel)
+                        .addComponent(resizeWidthField)
+                        .addComponent(resizeHeightLabel)
+                        .addComponent(resizeHeigitField))
+                    .addComponent(adjustRatioCheckBox)
+                    .addComponent(padCheckBox)));
+
 
         VideoInfoPanel.add(DoButton, gridBagConstraints71);
         VideoInfoPanel.add(OpPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
@@ -785,6 +791,7 @@ public class MainFrame extends JFrame {
 
     /* 変換・保存する */
     private Converter Converter = null;
+    // FFmpegの設定 ここから
     private final JLabel extOptionLabel = new JLabel();
     private final JTextField extOptionField = new JTextField();
     private JLabel mainOptionLabel = new JLabel();
@@ -795,6 +802,14 @@ public class MainFrame extends JFrame {
     private JTextField outputOptionField = new JTextField();
     private final JLabel avfilterOptionLabel = new JLabel();
     private final JTextField avfilterOptionField = new JTextField();
+    private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるようリサイズ");
+    private final JLabel resizeWidthLabel = new JLabel("横");
+    private final JTextField resizeWidthField = new JTextField();
+    private final JLabel resizeHeightLabel = new JLabel("縦");
+    private final JTextField resizeHeigitField = new JTextField();
+    private final JCheckBox adjustRatioCheckBox = new JCheckBox("アスペクト比を維持");
+    private final JCheckBox padCheckBox = new JCheckBox("黒幕を付与");
+    // FFmpegの設定 ここまで
     private JLabel FontIndexLabel = new JLabel();
     private JTextField fontIndexField = new JTextField();
     private JLabel VideoID_Label = new JLabel();