Example usage for javax.swing AbstractButton removeActionListener

List of usage examples for javax.swing AbstractButton removeActionListener

Introduction

In this page you can find the example usage for javax.swing AbstractButton removeActionListener.

Prototype

public void removeActionListener(ActionListener l) 

Source Link

Document

Removes an ActionListener from the button.

Usage

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);
        }
    }
}