use of javax.swing.ButtonModel in project kindergarten by clear-group-ausbildung.
the class NavigationButton method getCurrentColor.
private Color getCurrentColor() {
ButtonModel m = getModel();
String foregroundKey = m.isEnabled() ? "NavigationButton.foreground" : "NavigationButton.disabledForeground";
return RESOURCES.getColor(foregroundKey);
}
use of javax.swing.ButtonModel in project CodenameOne by codenameone.
the class ButtonBorder method paintBorder.
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
if (c instanceof AbstractButton) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
boolean isPressed;
boolean isRollover;
boolean isEnabled;
isPressed = model.isPressed() && model.isArmed();
isRollover = b.isRolloverEnabled() && model.isRollover();
isEnabled = b.isEnabled();
if (!isEnabled) {
paintDisabled(b, g, x, y, width, height);
} else {
if (isPressed) {
paintPressed(b, g, x, y, width, height);
} else if (isRollover) {
paintRollover(b, g, x, y, width, height);
} else {
paintNormal(b, g, x, y, width, height);
}
}
}
}
use of javax.swing.ButtonModel in project vcell by virtualcell.
the class ReactionCartoonEditorPanel method initConnections.
private void initConnections() throws Exception {
for (JToolBarToggleButton modeButton : getModeButtons()) {
modeButton.addActionListener(this);
}
for (JToolBarToggleButton viewButton : getViewButtons()) {
viewButton.addActionListener(this);
}
ButtonModel selection = modeButtonGroup.getSelection();
if (selection != null) {
getReactionCartoonTool().setModeString(selection.getActionCommand());
} else {
getReactionCartoonTool().setMode(Mode.SELECT);
}
getRandomLayoutButton().addActionListener(this);
getAnnealLayoutButton().addActionListener(this);
getCircleLayoutButton().addActionListener(this);
getRelaxerLayoutButton().addActionListener(this);
getLevellerLayoutButton().addActionListener(this);
getZoomInButton().addActionListener(this);
getZoomOutButton().addActionListener(this);
getGlgLayoutJButton().addActionListener(this);
getShrinkCanvasButton().addActionListener(this);
getExpandCanvasButton().addActionListener(this);
getFloatRequestButton().addActionListener(this);
getHighlightCatalystsButton().addActionListener(this);
for (JToolBarToggleButton sizeButton : getSizeOptionsButtons()) {
sizeButton.addActionListener(this);
}
}
use of javax.swing.ButtonModel in project vcell by virtualcell.
the class SpeciesQueryPanel method createDBSpecies.
/**
* Comment
*/
private void createDBSpecies(javax.swing.event.ListSelectionEvent listSelectionEvent) {
if (bIgnoreSelection) {
return;
}
if (getDocumentManager() != null) {
if (!listSelectionEvent.getValueIsAdjusting()) {
if (!((javax.swing.ListSelectionModel) listSelectionEvent.getSource()).isSelectionEmpty()) {
try {
javax.swing.JList selectionJList = null;
if (getCompoundJList().getSelectionModel() == listSelectionEvent.getSource()) {
selectionJList = getCompoundJList();
} else if (getEnzymeJList().getSelectionModel() == listSelectionEvent.getSource()) {
selectionJList = getEnzymeJList();
} else if (getProteinJList().getSelectionModel() == listSelectionEvent.getSource()) {
selectionJList = getProteinJList();
} else {
throw new RuntimeException("Unknown ListSelectionModel");
}
int[] selection = new int[1];
selection[0] = selectionJList.getSelectedIndex();
DBFormalSpecies[] dbFormalSpecies = jlistData.get(selectionJList);
String query = jlistQuery.get(selectionJList);
ButtonModel scope = jlistScope.get(selectionJList);
boolean bBound = (scope != getDictionaryJRadioButton().getModel());
boolean bOnlyUser = (scope == getMyModelJRadioButton().getModel());
DictionaryQueryResults dqr = null;
if (bBound) {
if (getDocumentManager().getUser() == null) {
throw new RuntimeException("Query results for 'My Model' can't be bound to null user");
}
org.vcell.util.document.User user = (bOnlyUser ? getDocumentManager().getUser() : null);
dqr = new DictionaryQueryResults(query, user, (DBSpecies[]) dbFormalSpecies, selection);
} else {
dqr = new DictionaryQueryResults(query, dbFormalSpecies, selection);
}
setDictionaryQueryResults(dqr);
// Clear other selections
bIgnoreSelection = true;
if (getCompoundJList() != selectionJList) {
getCompoundJList().clearSelection();
}
if (getEnzymeJList() != selectionJList) {
getEnzymeJList().clearSelection();
}
if (getProteinJList() != selectionJList) {
getProteinJList().clearSelection();
}
bIgnoreSelection = false;
} catch (Exception e) {
e.printStackTrace();
PopupGenerator.showErrorDialog(this, "Error:\n" + e.getMessage(), e);
}
} else {
setDictionaryQueryResults(null);
}
}
}
}
use of javax.swing.ButtonModel in project knime-core by knime.
the class DialogComponentButtonGroup method updateComponent.
/**
* {@inheritDoc}
*/
@Override
protected void updateComponent() {
final String val = ((SettingsModelString) getModel()).getStringValue();
final ButtonModel selectedButton = m_buttonGroup.getSelection();
final String actionCommand;
if (selectedButton != null) {
actionCommand = selectedButton.getActionCommand();
} else {
actionCommand = null;
}
boolean update;
if (val == null) {
update = (actionCommand != null);
} else {
update = !val.equals(actionCommand);
}
if (update) {
final Enumeration<AbstractButton> buttons = m_buttonGroup.getElements();
while (buttons.hasMoreElements()) {
final AbstractButton button = buttons.nextElement();
if (button.getActionCommand().equals(val)) {
button.setSelected(true);
}
}
}
// also update the enable status
setEnabledComponents(getModel().isEnabled());
}
Aggregations