List of usage examples for javax.swing ButtonModel setArmed
public void setArmed(boolean b);
From source file:JToggleButtonMenuItem.java
public void menuSelectionChanged(boolean isIncluded) { ButtonModel model = getModel(); // Only change armed state if different if (model.isArmed() != isIncluded) { model.setArmed(isIncluded); }/* w ww . ja v a 2s . c o m*/ if (isIncluded) { savedForeground = getForeground(); if (!savedForeground.equals(Color.BLUE)) { setForeground(Color.BLUE); } else { // In case foreground blue, use something different setForeground(Color.RED); } } else { setForeground(savedForeground); // If null, get foreground from installed look and feel if (savedForeground == null) { updateUI(); } } }
From source file:ToggleSample.java
public void menuSelectionChanged(boolean isIncluded) { ButtonModel model = getModel(); // only change armed state if different if (model.isArmed() != isIncluded) { model.setArmed(isIncluded); }/*from www. j av a 2 s .com*/ if (isIncluded) { savedForeground = getForeground(); if (!savedForeground.equals(Color.blue)) { setForeground(Color.blue); } else { // In case foreground blue, use something different setForeground(Color.red); } } else { setForeground(savedForeground); // if null, get foreground from installed look and feel if (savedForeground == null) { updateUI(); } } }