OSDN Git Service

videoInfoPanelのレイアウトをGroupLayoutで書き直し
[coroid/inqubus.git] / frontend / src / saccubus / MainFrame.java
index faf7552..4007c56 100644 (file)
@@ -106,7 +106,7 @@ public class MainFrame extends JFrame {
     private JTextField videoIdField = new JTextField();
     private JLabel wayBackLabel = new JLabel();
     private JTextField wayBackField = new JTextField();
-    JButton DoButton = new JButton();
+    private JButton doButton = new JButton();
     public static final String DoButtonDefString = "変換";
     public static final String DoButtonStopString = "停止";
     public static final String DoButtonWaitString = "待機";
@@ -176,11 +176,58 @@ public class MainFrame extends JFrame {
     }
 
     /**
+     * メイン画面最上部(ID/URL, 過去ログ, 変換ボタン)のパネルを初期化します.
+     */
+    private void initVideoInfoPanel() {
+
+        videoIdLabel.setText("URL/ID");
+        wayBackLabel.setText("過去ログ");
+        videoIdField.setText("http://www.nicovideo.jp/watch/");
+
+        final GroupLayout oppLayout = new GroupLayout(opPanel);
+        opPanel.setLayout(oppLayout);
+
+        oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
+                .addGroup(oppLayout.createParallelGroup()
+                    .addComponent(videoIdLabel)
+                    .addComponent(wayBackLabel))
+                .addGroup(oppLayout.createParallelGroup()
+                    .addComponent(videoIdField)
+                    .addGroup(oppLayout.createSequentialGroup()
+                        .addComponent(wayBackField)))
+                );
+
+        oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
+                    .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+                        .addComponent(videoIdLabel)
+                        .addComponent(videoIdField))
+                    .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+                        .addComponent(wayBackLabel)
+                        .addComponent(wayBackField))
+                );
+
+        doButton.setText(DoButtonDefString);
+        doButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
+
+        final GroupLayout vipLayout = new GroupLayout(videoInfoPanel);
+        videoInfoPanel.setLayout(vipLayout);
+
+        vipLayout.setHorizontalGroup(vipLayout.createSequentialGroup()
+                .addComponent(opPanel).addComponent(doButton));
+
+        vipLayout.setVerticalGroup(vipLayout.createParallelGroup()
+                .addComponent(opPanel).addComponent(doButton, 10, 20, 50));
+    }
+
+    /**
      * コンポーネントの初期化。
      *
      * @throws java.lang.Exception
      */
     private void jbInit() throws Exception {
+
+        initVideoInfoPanel();
+
         GridBagConstraints gridBagConstraints74 = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                 GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0);
         gridBagConstraints74.gridwidth = 2;
@@ -201,10 +248,6 @@ public class MainFrame extends JFrame {
         ShadowKindLabel = new JLabel();
         ShadowKindLabel.setText("影の種類");
         ShadowKindLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
-        GridBagConstraints gridBagConstraints71 = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
-                GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 6);
-        gridBagConstraints71.fill = GridBagConstraints.BOTH;
-        gridBagConstraints71.ipady = 0;
         GridBagConstraints gridBagConstraints66 = new GridBagConstraints();
         gridBagConstraints66.gridx = 0;
         gridBagConstraints66.insets = new Insets(0, 5, 5, 5);
@@ -329,7 +372,6 @@ public class MainFrame extends JFrame {
         jMenuHelpAbout.setText("バージョン情報");
         jMenuHelpAbout.addActionListener(new MainFrame_jMenuHelpAbout_ActionAdapter(
                 this));
-        videoInfoPanel.setLayout(gridBagLayout1);
         SavingInfoTabPanel.setLayout(new GridLayout());
         UserInfoPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "ユーザ設定"));
         UserInfoPanel.setLayout(gridBagLayout3);
@@ -484,40 +526,6 @@ public class MainFrame extends JFrame {
         setFFMpegOptionCheckbox();
 
 
-        videoInfoPanel.add(DoButton, gridBagConstraints71);
-
-        videoIdLabel.setText("URL/ID");
-        wayBackLabel.setText("過去ログ");
-        videoIdField.setText("http://www.nicovideo.jp/watch/");
-        DoButton.setText(DoButtonDefString);
-        DoButton.addActionListener(new MainFrame_DoButton_actionAdapter(this));
-
-        final GroupLayout oppLayout = new GroupLayout(opPanel);
-        opPanel.setLayout(oppLayout);
-
-        oppLayout.setHorizontalGroup(oppLayout.createSequentialGroup()
-                .addGroup(oppLayout.createParallelGroup()
-                    .addComponent(videoIdLabel)
-                    .addComponent(wayBackLabel))
-                .addGroup(oppLayout.createParallelGroup()
-                    .addComponent(videoIdField)
-                    .addGroup(oppLayout.createSequentialGroup()
-                        .addComponent(wayBackField)))
-                );
-
-        oppLayout.setVerticalGroup(oppLayout.createSequentialGroup()
-                    .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-                        .addComponent(videoIdLabel)
-                        .addComponent(videoIdField))
-                    .addGroup(oppLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-                        .addComponent(wayBackLabel)
-                        .addComponent(wayBackField))
-                );
-
-
-        videoInfoPanel.add(opPanel, new GridBagConstraints(0, 0, 1, 1, 1.0,
-                0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
-                new Insets(0, 0, 0, 0), 0, 0));
 
         mainTabbedPane.add(BasicInfoTabPanel, "基本設定");
         mainTabbedPane.add(SavingInfoTabPanel, "保存設定");
@@ -859,7 +867,6 @@ public class MainFrame extends JFrame {
     // FFmpegの設定 ここまで
     private JLabel FontIndexLabel = new JLabel();
     private JTextField fontIndexField = new JTextField();
-    private GridBagLayout gridBagLayout1 = new GridBagLayout();
     private JPanel BasicInfoTabPanel = new JPanel();
     private GridBagLayout gridBagLayout12 = new GridBagLayout();
     private JPanel ConvertingSettingPanel = null;
@@ -946,10 +953,10 @@ public class MainFrame extends JFrame {
                     public void run() {
                         switch (s) {
                             case STOPPING:
-                                DoButton.setText(DoButtonWaitString);
+                                doButton.setText(DoButtonWaitString);
                                 break;
                             case FINISHED:
-                                DoButton.setText(DoButtonDefString);
+                                doButton.setText(DoButtonDefString);
                         }
                     }
                 });
@@ -958,7 +965,7 @@ public class MainFrame extends JFrame {
 
         Converter = new Converter(url, wayBackField.getText(), getSetting().toProfile(), sl,
                 new ConvertStopFlag(scl));
-        DoButton.setText(DoButtonStopString);
+        doButton.setText(DoButtonStopString);
         new Thread(Converter).start();
 
     }