public class OptionBox extends JPanel
implements MouseListener, ActionListener
{
- JCheckBox enabled = new JCheckBox();
+ JCheckBox enabled;
final URL finfo;
OptionI option;
- JLabel optlabel = new JLabel();
-
- JComboBox<String> val = new JComboBox<>();
+ JComboBox<String> val;
public OptionBox(OptionI opt)
{
option = opt;
setLayout(new FlowLayout(FlowLayout.LEFT));
+ enabled = new JCheckBox();
enabled.setSelected(opt.isRequired()); // TODO: lock required options
enabled.setFont(new Font("Verdana", Font.PLAIN, 11));
enabled.setText("");
}
}
add(enabled);
+
+ // todo combo or radio buttons?
+ val = new JComboBox<>();
for (String str : opt.getPossibleValues())
{
val.addItem(str);
* ensure slider has an integer range corresponding to
* the min-max range of the parameter
*/
- if (validator.getMin() != null && !isIntegerParameter
+ if (validator.getMin() != null && validator.getMax() != null
+ // && !isIntegerParameter
&& !isStringParameter)
{
double min = validator.getMin().doubleValue();
// todo scaleMin, scaleMax could also be final fields
}
}
- else
- {
- isChoiceParameter = parameter.getPossibleValues() != null;
- }
+
+ List<String> possibleValues = parameter.getPossibleValues();
+ isChoiceParameter = possibleValues != null
+ && possibleValues.size() > 1;
if (compact)
{