OSDN Git Service

スレッド数の入力部をスピナーに変更
authoryukihane <yukihane.feather@gmail.com>
Fri, 2 Sep 2011 12:46:14 +0000 (21:46 +0900)
committeryukihane <yukihane.feather@gmail.com>
Fri, 9 Sep 2011 11:40:48 +0000 (20:40 +0900)
frontend/src/yukihane/inqubus/gui/ConfigDialog.java

index cae59a3..b7e83d4 100644 (file)
@@ -27,9 +27,11 @@ import javax.swing.JFileChooser;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
+import javax.swing.JSpinner;
 import javax.swing.JTabbedPane;
 import javax.swing.JTextField;
 import javax.swing.LayoutStyle.ComponentPlacement;
+import javax.swing.SpinnerNumberModel;
 import javax.swing.UIManager;
 import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.WindowConstants;
@@ -662,6 +664,13 @@ public class ConfigDialog extends JDialog {
         btnSystemTempDir.addActionListener(
                 new FileChooseAction(ConfigDialog.this, JFileChooser.DIRECTORIES_ONLY, fldSystemTempDir));
 
+        mdlSystemThreadDownload.setMinimum(1);
+        final JSpinner fldSystemThreadDownload = new JSpinner(mdlSystemThreadDownload);
+        mdlSystemWaitDownload.setMinimum(0);
+        final JSpinner fldSystemWaitDownload = new JSpinner(mdlSystemWaitDownload);
+        mdlSystemThreadConvert.setMinimum(1);
+        final JSpinner fldSystemThreadConvert = new JSpinner(mdlSystemThreadConvert);
+
         final JPanel pnlSystemGeneral = new JPanel();
         pnlSystemGeneral.setBorder(BorderFactory.createTitledBorder("システム"));
         final GroupLayout glSystemGenegal = new GroupLayout(pnlSystemGeneral);
@@ -676,9 +685,9 @@ public class ConfigDialog extends JDialog {
                     .addComponent(lblSystemWaitDownload)
                     .addComponent(lblSystemThreadConvert))
                 .addGroup(glSystemGenegal.createParallelGroup()
-                    .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
-                    .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 40, PREFERRED_SIZE)
-                    .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 40, PREFERRED_SIZE)
+                    .addComponent(fldSystemThreadDownload, PREFERRED_SIZE, 50, PREFERRED_SIZE)
+                    .addComponent(fldSystemWaitDownload, PREFERRED_SIZE, 55, PREFERRED_SIZE)
+                    .addComponent(fldSystemThreadConvert, PREFERRED_SIZE, 50, PREFERRED_SIZE)
                 )
             )
             .addGroup(glSystemGenegal.createSequentialGroup()
@@ -809,9 +818,9 @@ public class ConfigDialog extends JDialog {
     // 検索 - コメント検索対象フォルダ
     private final DirectoryRegisterPanel pnlSearchComment = new DirectoryRegisterPanel();
     // システム
-    private final JTextField fldSystemThreadDownload = new JTextField();
-    private final JTextField fldSystemWaitDownload = new JTextField();
-    private final JTextField fldSystemThreadConvert = new JTextField();
+    private final SpinnerNumberModel mdlSystemThreadDownload = new SpinnerNumberModel();
+    private final SpinnerNumberModel mdlSystemWaitDownload = new SpinnerNumberModel();
+    private final SpinnerNumberModel mdlSystemThreadConvert = new SpinnerNumberModel();
     private final JTextField fldSystemTempDir = new JTextField();
 
 
@@ -909,9 +918,9 @@ public class ConfigDialog extends JDialog {
         /*
          * システム
          */
-        fldSystemThreadDownload.setText(Integer.toString(p.getSystemDownloadThread()));
-        fldSystemWaitDownload.setText(Integer.toString(p.getSystemDownloadWait()));
-        fldSystemThreadConvert.setText(Integer.toString(p.getSystemConvertThread()));
+        mdlSystemThreadDownload.setValue(p.getSystemDownloadThread());
+        mdlSystemWaitDownload.setValue(p.getSystemDownloadWait());
+        mdlSystemThreadConvert.setValue(p.getSystemConvertThread());
         fldSystemTempDir.setText(p.getSystemTempDir());
     }
 
@@ -1016,9 +1025,9 @@ public class ConfigDialog extends JDialog {
         /*
          * システム
          */
-        p.setSystemDownloadThread(Integer.parseInt(fldSystemThreadDownload.getText()));
-        p.setSystemDownloadWait(Integer.parseInt(fldSystemWaitDownload.getText()));
-        p.setSystemConvertThread(Integer.parseInt(fldSystemThreadConvert.getText()));
+        p.setSystemDownloadThread(mdlSystemThreadDownload.getNumber().intValue());
+        p.setSystemDownloadWait(mdlSystemWaitDownload.getNumber().intValue());
+        p.setSystemConvertThread(mdlSystemThreadConvert.getNumber().intValue());
         p.setSystemTempDir(fldSystemTempDir.getText());
 
         try {