use of javax.swing.ButtonModel in project scylla by bptlab.
the class ScalingCheckBoxIcon method paintIcon.
/**
* Overriden paint method
*/
@Override
public void paintIcon(Component checkBox, Graphics g, int x, int y) {
int xoff = (size) / 8;
int yoff = (checkBox.getHeight() - size) / 2;
int border = size / 8;
ButtonModel checkBoxModel = ((AbstractButton) checkBox).getModel();
g.setColor(ScyllaGUI.ColorField2);
g.fillRect(xoff, yoff, size, size);
g.setColor(ScyllaGUI.ColorBackground);
if (!checkBoxModel.isRollover())
g.drawRect(xoff, yoff, size, size);
if (checkBoxModel.isPressed()) {
g.setColor(ScyllaGUI.ColorField1);
g.fillRect(border + xoff, border + yoff, size - 2 * border + 1, size - 2 * border + 1);
} else if (checkBoxModel.isSelected()) {
g.setColor(ScyllaGUI.ColorBackground);
g.fillRect(border + xoff, border + yoff, size - 2 * border + 1, size - 2 * border + 1);
}
}
use of javax.swing.ButtonModel in project vcell by virtualcell.
the class ResourceImportPanel method getSelectedOption.
public T getSelectedOption() {
T selectedOption = null;
ButtonModel selectedButtonModel = buttonGroup.getSelection();
if (selectedButtonModel != null) {
selectedOption = button2optionMap.get(selectedButtonModel);
}
return selectedOption;
}
use of javax.swing.ButtonModel in project vcell by virtualcell.
the class PropertyChangeButtonGroup method setSelected.
/**
* Sets the selected value for the button.
*/
@Override
public void setSelected(ButtonModel m, boolean b) {
ButtonModel old = getSelection();
super.setSelected(m, b);
firePropertyChange("selection", old, m);
}
use of javax.swing.ButtonModel in project vcell by virtualcell.
the class ButtonGroupCivilized method setSelection.
/**
* This method was created in VisualAge.
* @param actionCommand java.lang.String
*/
public void setSelection(String actionCommand) {
//
// if selected button does not have this action command, select the first button we find with appropriate action command
//
String currSelectedString = null;
if (getSelection() != null) {
currSelectedString = getSelection().getActionCommand();
}
if (currSelectedString != null) {
if (currSelectedString.equals(actionCommand)) {
return;
}
}
ButtonModel buttonModel = null;
Enumeration<AbstractButton> buttons = getElements();
while (buttons.hasMoreElements()) {
buttonModel = ((AbstractButton) buttons.nextElement()).getModel();
if (buttonModel.getActionCommand().equals(actionCommand)) {
setSelection(buttonModel);
return;
}
}
//
if (buttonModel != null) {
System.out.println("ERROR: button with actionCommand " + actionCommand + " not found");
}
}
use of javax.swing.ButtonModel in project knime-core by knime.
the class DialogComponentButtonGroup method updateModel.
/**
* Transfers the current value from the component into the model.
*/
private void updateModel() {
// we transfer the value from the button group into the model
final ButtonModel selectedButton = m_buttonGroup.getSelection();
final String actionCommand;
if (selectedButton != null) {
actionCommand = selectedButton.getActionCommand();
} else {
actionCommand = null;
}
((SettingsModelString) getModel()).setStringValue(actionCommand);
}
Aggregations