JAL-1010 write validated value back to text field to ensure parameter value is always...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 25 Sep 2012 13:30:00 +0000 (14:30 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 25 Sep 2012 13:30:00 +0000 (14:30 +0100)
src/jalview/gui/OptsAndParamsPage.java

index 05c8e1d..0f6126c 100644 (file)
@@ -660,6 +660,8 @@ public class OptsAndParamsPage
           {
           }
           ;
+          // update value field to reflect any bound checking we performed.
+          valueField.setText(""+iVal);
           if (validator.getMin() != null && validator.getMax() != null)
           {
             slider.getModel().setRangeProperties(iVal, 1,
@@ -678,6 +680,7 @@ public class OptsAndParamsPage
           fVal = 0f;
           try
           {
+            valueField.setText(valueField.getText().trim());
             fVal = Float.valueOf(valueField.getText());
             if (validator.getMin() != null
                     && validator.getMin().floatValue() > fVal)
@@ -685,6 +688,8 @@ public class OptsAndParamsPage
               fVal = validator.getMin().floatValue();
               // TODO: provide visual indication that hard limit was reached for
               // this parameter
+              // update value field to reflect any bound checking we performed.
+              valueField.setText(""+fVal);
             }
             if (validator.getMax() != null
                     && validator.getMax().floatValue() < fVal)
@@ -692,6 +697,8 @@ public class OptsAndParamsPage
               fVal = validator.getMax().floatValue();
               // TODO: provide visual indication that hard limit was reached for
               // this parameter
+              // update value field to reflect any bound checking we performed.
+              valueField.setText(""+fVal);
             }
           } catch (Exception e)
           {