private void updateParameter() { final boolean newValue = getRadioButton().isSelected(); getParameter().setValue(newValue, null); } }
@Override public void updateUI() { super.updateUI(); final boolean newValue; if (getParameter().getValue() instanceof Boolean) { newValue = (Boolean) getParameter().getValue(); } else { newValue = Boolean.valueOf(getParameter().getValueAsText()); } if (getRadioButton().isSelected() != newValue) { getRadioButton().setSelected(newValue); } if (getRadioButton().isEnabled() != isEnabled()) { getRadioButton().setEnabled(isEnabled()); } }
@Override protected void initUI() { // do not call super.initUI() since we don't want any labels to be created _radioButton = new JRadioButton(); nameEditorComponent(_radioButton); if (getParameter().getProperties().getLabel() != null) { _radioButton.setText(getParameter().getProperties().getLabel()); } if (getParameter().getProperties().getDescription() != null) { _radioButton.setToolTipText(getParameter().getProperties().getDescription()); } _radioButton.addItemListener(new ItemListener() { public void itemStateChanged(final ItemEvent event) { updateParameter(); } }); }
/** * Gets the UI component used to edit the parameter's value. */ public JComponent getEditorComponent() { return getRadioButton(); }