JAL-4034 Allow request for non-modal JDialog, which puts the Runnable action into...
[jalview.git] / src / jalview / gui / OptsAndParamsPage.java
index ba575ae..e0427cc 100644 (file)
@@ -93,7 +93,7 @@ public class OptsAndParamsPage
 
     JLabel optlabel = new JLabel();
 
-    JComboBox val = new JComboBox();
+    JComboBox<String> val = new JComboBox<>();
 
     public OptionBox(OptionI opt)
     {
@@ -127,7 +127,7 @@ public class OptsAndParamsPage
         }
       }
       add(enabled, BorderLayout.NORTH);
-      for (Object str : opt.getPossibleValues())
+      for (String str : opt.getPossibleValues())
       {
         val.addItem(str);
       }
@@ -574,9 +574,8 @@ public class OptsAndParamsPage
       if (!adjusting)
       {
         float value = slider.getSliderValue();
-        valueField.setText(
-                integ ? Integer.toString((int) value)
-                        : Float.toString(value));
+        valueField.setText(integ ? Integer.toString((int) value)
+                : Float.toString(value));
         checkIfModified();
       }
     }
@@ -589,7 +588,7 @@ public class OptsAndParamsPage
       {
         if (choice)
         {
-          choicebox = new JComboBox();
+          choicebox = new JComboBox<>();
           choicebox.addActionListener(this);
           controlPanel.add(choicebox, BorderLayout.CENTER);
         }
@@ -622,17 +621,20 @@ public class OptsAndParamsPage
             {
             }
           });
-          valueField.addFocusListener(new FocusAdapter() {
+          valueField.addFocusListener(new FocusAdapter()
+          {
 
             @Override
             public void focusLost(FocusEvent e)
             {
               actionPerformed(null);
             }
-            
+
           });
           valueField.setPreferredSize(new Dimension(60, 25));
+          valueField.setText(parm.getValue());
           slider = makeSlider(parm.getValidValue());
+          updateSliderFromValueField();
           slider.addChangeListener(this);
 
           controlPanel.add(slider, BorderLayout.WEST);
@@ -699,8 +701,7 @@ public class OptsAndParamsPage
           {
             valueField.setText(valueField.getText().trim());
             iVal = Integer.valueOf(valueField.getText());
-            if (minValue != null
-                    && minValue.intValue() > iVal)
+            if (minValue != null && minValue.intValue() > iVal)
             {
               iVal = minValue.intValue();
               // TODO: provide visual indication that hard limit was reached for
@@ -731,8 +732,7 @@ public class OptsAndParamsPage
           {
             valueField.setText(valueField.getText().trim());
             fVal = Float.valueOf(valueField.getText());
-            if (minValue != null
-                    && minValue.floatValue() > fVal)
+            if (minValue != null && minValue.floatValue() > fVal)
             {
               fVal = minValue.floatValue();
               // TODO: provide visual indication that hard limit was reached for
@@ -740,8 +740,7 @@ public class OptsAndParamsPage
               // update value field to reflect any bound checking we performed.
               valueField.setText("" + fVal);
             }
-            if (maxValue != null
-                    && maxValue.floatValue() < fVal)
+            if (maxValue != null && maxValue.floatValue() < fVal)
             {
               fVal = maxValue.floatValue();
               // TODO: provide visual indication that hard limit was reached for