List of usage examples for javax.swing AbstractButton removeActionListener
public void removeActionListener(ActionListener l)
ActionListener
from the button. From source file:Main.java
/** * select silently//from ww w. ja v a 2 s . com * @param aButton button * @param isSelected indicates if button should be selected * @param aListener listener to be removed when selecting index */ public final static void SelectSilently(AbstractButton aButton, boolean isSelected, ActionListener aListener) { aButton.removeActionListener(aListener); aButton.setSelected(isSelected); aButton.addActionListener(aListener); }
From source file:Main.java
public static void removeAllActionListeners(final AbstractButton abstractButton) { if (abstractButton != null) { runInEDT(() -> {/*from ww w. j av a 2 s . co m*/ for (final ActionListener actionListener : abstractButton.getActionListeners()) { abstractButton.removeActionListener(actionListener); } }); } }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Updates UI components when a new color model is selected. * /*from w w w .ja va 2 s. co m*/ * @param key The index of the color model. */ void setColorModel(int key) { controlPane.setColorModel(); AbstractButton b; Action a; Enumeration<AbstractButton> e; for (e = colorModelGroup.getElements(); e.hasMoreElements();) { b = e.nextElement(); a = b.getAction(); if (a instanceof ColorModelAction) { b.removeActionListener(a); b.setSelected(((ColorModelAction) a).getIndex() == key); b.setAction(a); } } }