Capped the maximum throttle value to 1000. (#434)

* Capped the maximum throttle value to 1000.

Entering extremely large values into the maximum value field of the throttle GUI caused the GUI to freeze. Imposing a cap of 1000 to the maximum value prevents the GUI from freezing.

* Updated brace style from Allman to K&R.
This commit is contained in:
Christopher LaChance 2017-06-06 09:08:10 -05:00 committed by GitHub
parent 39aef15a8e
commit af6b8cbea8

View File

@ -191,7 +191,15 @@ public class SimControlActionController {
maxField.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
slider.setDoubleMaximum(Double.valueOf(maxField.getText()));
// CTLaChance - 05-22-17
// Cap the maximum possible value to 1000.
if(Double.valueOf(maxField.getText()) > 1000) {
maxField.setText(Double.toString(1000));
slider.setDoubleMaximum(1000);
}
else {
slider.setDoubleMaximum(Double.valueOf(maxField.getText()));
}
}
});