Example usage for javax.swing JComponent removeMouseListener

List of usage examples for javax.swing JComponent removeMouseListener

Introduction

In this page you can find the example usage for javax.swing JComponent removeMouseListener.

Prototype

public synchronized void removeMouseListener(MouseListener l) 

Source Link

Document

Removes the specified mouse listener so that it no longer receives mouse events from this component.

Usage

From source file:MyCheckBoxUI.java

public void uninstallUI(JComponent c) {
    super.uninstallUI(c);
    c.removeMouseListener(this);
}

From source file:MyButtonUI.java

public void uninstallUI(JComponent c) {
    super.uninstallUI(c);
    c.removeMouseListener(this);
    c.removeKeyListener(this);
}

From source file:de.codesourcery.eve.skills.ui.utils.PopupMenuBuilder.java

public PopupMenuBuilder detach(JComponent comp) {
    comp.removeMouseListener(this);
    return this;
}

From source file:com.anrisoftware.prefdialog.miscswing.components.menu.PopupMenuComponent.java

/**
 * Sets the component for which the pop-menu is shown.
 * //from  ww w  . j  a  v a2s .  c  om
 * @param component
 *            the {@link JComponent}.
 * 
 * @throws NullPointerException
 *             if the specified component is {@code null}.
 */
public void setComponent(JComponent component) {
    notNull(component);
    JComponent oldValue = this.component;
    this.component = component;
    if (oldValue != null) {
        oldValue.removeMouseListener(componentMouseListener);
    }
    component.addMouseListener(componentMouseListener);
}

From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java

/**
 * Register tooltip for component.//  w w  w.  j  a v  a 2 s . c  o m
 * The tooltip is displayed when a user either presses F1 on a focused component or hovers over it.
 * ToolTip text is taken from {@link javax.swing.JComponent#getToolTipText()}.
 *
 * @param component component to register
 */
public void registerTooltip(final JComponent component) {
    component.removeKeyListener(fieldKeyListener);
    component.addKeyListener(fieldKeyListener);

    component.removeMouseListener(componentMouseListener);
    component.addMouseListener(componentMouseListener);
}

From source file:Main.java

private static void disposeComponent(JComponent component) {
    if (component == null) {
        return;/* w ww.j ava2 s . co m*/
    }
    component.removeNotify();
    FocusListener[] focusListeners = component.getFocusListeners();
    for (int i = 0; i < focusListeners.length; i++) {
        component.removeFocusListener(focusListeners[i]);
    }
    KeyListener[] keyListeners = component.getKeyListeners();
    for (int i = 0; i < keyListeners.length; i++) {
        component.removeKeyListener(keyListeners[i]);
    }
    AncestorListener[] ancestorListener = component.getAncestorListeners();
    for (int i = 0; i < ancestorListener.length; i++) {
        component.removeAncestorListener(ancestorListener[i]);
    }
    ComponentListener[] componentListeners = component.getComponentListeners();
    for (int i = 0; i < componentListeners.length; i++) {
        component.removeComponentListener(componentListeners[i]);
    }
    HierarchyListener[] hierarchyListeners = component.getHierarchyListeners();
    for (int i = 0; i < hierarchyListeners.length; i++) {
        component.removeHierarchyListener(hierarchyListeners[i]);
    }
    HierarchyBoundsListener[] hierarchyBoundsListeners = component.getHierarchyBoundsListeners();
    for (int i = 0; i < hierarchyBoundsListeners.length; i++) {
        component.removeHierarchyBoundsListener(hierarchyBoundsListeners[i]);
    }
    InputMethodListener[] inputMethodListeners = component.getInputMethodListeners();
    for (int i = 0; i < inputMethodListeners.length; i++) {
        component.removeInputMethodListener(inputMethodListeners[i]);
    }
    MouseListener[] mouseLisetners = component.getMouseListeners();
    for (int i = 0; i < mouseLisetners.length; i++) {
        component.removeMouseListener(mouseLisetners[i]);
    }
    MouseMotionListener[] mouseMotionLisetners = component.getMouseMotionListeners();
    for (int i = 0; i < mouseMotionLisetners.length; i++) {
        component.removeMouseMotionListener(mouseMotionLisetners[i]);
    }
    MouseWheelListener[] mouseWheelListeners = component.getMouseWheelListeners();
    for (int i = 0; i < mouseWheelListeners.length; i++) {
        component.removeMouseWheelListener(mouseWheelListeners[i]);
    }
    PropertyChangeListener[] propertyChangeListeners = component.getPropertyChangeListeners();
    for (int i = 0; i < propertyChangeListeners.length; i++) {
        component.removePropertyChangeListener(propertyChangeListeners[i]);
    }
    VetoableChangeListener[] vetoableChangeListener = component.getVetoableChangeListeners();
    for (int i = 0; i < vetoableChangeListener.length; i++) {
        component.removeVetoableChangeListener(vetoableChangeListener[i]);
    }

}