Java Code Examples for javax.swing.JComponent#removeMouseWheelListener()

The following examples show how to use javax.swing.JComponent#removeMouseWheelListener() . 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: Rubber.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Actually register the rubber as the mouse listener for the provided component.
 *
 * @param component the related component
 */
public final void connectComponent (JComponent component)
{
    // Clean up if needed
    disconnectComponent(this.component);

    // Remember the related component (to get visible rect, etc ...)
    this.component = component;

    if (component != null) {
        // To be notified of mouse clicks
        component.removeMouseListener(this); // No multiple notifications
        component.addMouseListener(this);

        // To be notified of mouse mouvements
        component.removeMouseMotionListener(this); // No multiple notifs
        component.addMouseMotionListener(this);

        // To be notified of mouse  wheel mouvements
        component.removeMouseWheelListener(this); // No multiple notifs
        component.addMouseWheelListener(this);
    }
}
 
Example 2
Source File: Rubber.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Actually register the rubber as the mouse listener for the provided
 * component.
 *
 * @param component the related component
 */
public void connectComponent (JComponent component)
{
    // Clean up if needed
    disconnectComponent(this.component);

    // Remember the related component (to get visible rect, etc ...)
    this.component = component;

    // To be notified of mouse clicks
    component.removeMouseListener(this); // No multiple notifications
    component.addMouseListener(this);

    // To be notified of mouse mouvements
    component.removeMouseMotionListener(this); // No multiple notifs
    component.addMouseMotionListener(this);

    // To be notified of mouse  wheel mouvements
    component.removeMouseWheelListener(this); // No multiple notifs
    component.addMouseWheelListener(this);
}
 
Example 3
Source File: Rubber.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Disconnect the provided component
 *
 * @param component the component to disconnect
 */
private void disconnectComponent (JComponent component)
{
    if (component != null) {
        component.removeMouseListener(this);
        component.removeMouseMotionListener(this);
        component.removeMouseWheelListener(this);
    }
}
 
Example 4
Source File: JScrollableToolTip.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void removeNotify() {
    JComponent comp = getComponent();
    if(comp != null) {
        comp.removeMouseWheelListener(this);
    } 
    super.removeNotify();
}
 
Example 5
Source File: Rubber.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Disconnect the provided component
 *
 * @param component the component to disconnect
 */
public void disconnectComponent (JComponent component)
{
    if (component != null) {
        component.removeMouseListener(this);
        component.removeMouseMotionListener(this);
        component.removeMouseWheelListener(this);
    }
}
 
Example 6
Source File: PointerEventHandler.java    From jfxvnc with Apache License 2.0 4 votes vote down vote up
public void unregister(JComponent node) {
  node.removeMouseMotionListener(mouseMotionEventHandler);
  node.removeMouseListener(mouseEventHandler);
  node.removeMouseWheelListener(mouseWheelEventHandler);
}