JLabel optlabel = new JLabel();
- JComboBox val = new JComboBox();
+ JComboBox<String> val = new JComboBox<>();
public OptionBox(OptionI opt)
{
}
}
add(enabled, BorderLayout.NORTH);
- for (Object str : opt.getPossibleValues())
+ for (String str : opt.getPossibleValues())
{
val.addItem(str);
}
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();
}
}
{
if (choice)
{
- choicebox = new JComboBox();
+ choicebox = new JComboBox<>();
choicebox.addActionListener(this);
controlPanel.add(choicebox, BorderLayout.CENTER);
}
{
}
});
- 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);
{
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
{
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
// 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