Java Code Examples for javax.swing.AbstractButton#removeActionListener()

The following examples show how to use javax.swing.AbstractButton#removeActionListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionUtilities.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Remove all action listeners from a button.
 * 
 * @param button Button.
 */
public static void removeActionListeners(AbstractButton button) {
  if (button == null) {
    return;
  }
  ActionListener[] listeners = button.getActionListeners();
  if (listeners == null) {
    return;
  }
  for (ActionListener listener : listeners) {
    button.removeActionListener(listener);
  }
}
 
Example 2
Source File: SlideGestureRecognizer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Detaches given button from this recognizer, it means stops listening
 * on its various mouse and action events
 */
public void detachButton (AbstractButton button) {
    button.removeActionListener(this);
    button.removeMouseListener(this);
    button.addMouseMotionListener(this);
}