Search in sources :

Example 1 with ScriptParam

use of org.jwildfire.create.tina.script.ScriptParam in project JWildfire by thargor6.

the class ScriptParamsForm method collectFieldValues.

private void collectFieldValues() {
    params.clear();
    for (Object control : namedControls) {
        if (control instanceof JWFNumberField) {
            JWFNumberField numberField = (JWFNumberField) control;
            params.put(numberField.getName(), new ScriptParam(numberField.getDoubleValue()));
        } else if (control instanceof JTextField) {
            JTextField textField = (JTextField) control;
            params.put(textField.getName(), new ScriptParam(textField.getText()));
        } else if (control instanceof JComboBox) {
            JComboBox comboBox = (JComboBox) control;
            params.put(comboBox.getName(), new ScriptParam((String) comboBox.getSelectedItem()));
        } else if (control instanceof JCheckBox) {
            JCheckBox checkBox = (JCheckBox) control;
            params.put(checkBox.getName(), new ScriptParam(checkBox.isSelected()));
        } else {
            throw new IllegalStateException(control.getClass().getName());
        }
    }
}
Also used : ScriptParam(org.jwildfire.create.tina.script.ScriptParam) JCheckBox(javax.swing.JCheckBox) JComboBox(javax.swing.JComboBox) JTextField(javax.swing.JTextField) JWFNumberField(org.jwildfire.create.tina.swing.JWFNumberField)

Aggregations

JCheckBox (javax.swing.JCheckBox)1 JComboBox (javax.swing.JComboBox)1 JTextField (javax.swing.JTextField)1 ScriptParam (org.jwildfire.create.tina.script.ScriptParam)1 JWFNumberField (org.jwildfire.create.tina.swing.JWFNumberField)1