Java Code Examples for java.awt.event.MouseWheelEvent#isConsumed()

The following examples show how to use java.awt.event.MouseWheelEvent#isConsumed() . 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: MouseManager.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public MouseWheelEvent processMouseWheelMoved(MouseWheelEvent mouseWheelEvent)
{
	if (mouseWheelEvent.isConsumed())
	{
		return mouseWheelEvent;
	}

	for (MouseWheelListener mouseWheelListener : mouseWheelListeners)
	{
		mouseWheelEvent = mouseWheelListener.mouseWheelMoved(mouseWheelEvent);
		if (mouseWheelEvent.isConsumed())
		{
			break;
		}
	}
	return mouseWheelEvent;
}
 
Example 2
Source File: LWScrollPanePeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 3
Source File: LWScrollPanePeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 4
Source File: LWScrollPanePeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 5
Source File: LWScrollPanePeer.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 6
Source File: LWScrollPanePeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 7
Source File: LWScrollPanePeer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 8
Source File: LWScrollPanePeer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 9
Source File: QuadroDeEdicao.java    From brModelo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (getDiagramaAtual() == null) {
        return;
    }
    getDiagramaAtual().mouseWheelMoved(e);
    if (!e.isConsumed()) {
        master.ScrollMove(e);
    }
    
    super.mouseWheelMoved(e);
}
 
Example 10
Source File: LWScrollPanePeer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 11
Source File: LWScrollPanePeer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 12
Source File: LWScrollPanePeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 13
Source File: AbstractTabDisplayer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public final void mouseWheelMoved( MouseWheelEvent e ) {
    scrollLeft.mouseWheelMoved( e );
    if( e.isConsumed() )
        return;
    scrollRight.mouseWheelMoved( e );
}
 
Example 14
Source File: LWScrollPanePeer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 15
Source File: LWScrollPanePeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 16
Source File: LWScrollPanePeer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handleEvent(AWTEvent e) {
    if (e instanceof MouseWheelEvent) {
        MouseWheelEvent wheelEvent = (MouseWheelEvent) e;
        //java.awt.ScrollPane consumes the event
        // in case isWheelScrollingEnabled() is true,
        // forcibly send the consumed event to the delegate
        if (getTarget().isWheelScrollingEnabled() && wheelEvent.isConsumed()) {
            sendEventToDelegate(wheelEvent);
        }
    } else {
        super.handleEvent(e);
    }
}
 
Example 17
Source File: MouseEventUI.java    From darklaf with MIT License 5 votes vote down vote up
/**
 * Re-dispatches the event to the first component in the hierarchy that has a {@link MouseWheelListener}
 * registered.
 */
@Override
protected void processMouseWheelEvent(final MouseWheelEvent event,
                                      final JXLayer<? extends V> jxlayer) {
    /*
     * Only process an event if it is not already consumed. This may be the
     * case if this LayerUI is contained in a wrapped hierarchy.
     */
    if (!event.isConsumed()) {
        /*
         * Since we will create a new event, the argument event must be
         * consumed.
         */
        event.consume();
        /*
         * Find a target up in the hierarchy that has
         * MouseWheelEventListeners registered.
         */
        Component target = event.getComponent();
        Component newTarget = findWheelListenerComponent(target);
        if (newTarget == null) {
            newTarget = jxlayer.getParent();
        }
        /*
         * Convert the location relative to the new target
         */
        Point point = SwingUtilities.convertPoint(event.getComponent(),
                                                  event.getPoint(), newTarget);
        /*
         * Create a new event and dispatch it.
         */
        newTarget.dispatchEvent(createMouseWheelEvent(event, point,
                                                      newTarget));
    }
}
 
Example 18
Source File: JBScrollPane.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Indicates whether the specified event is not consumed and does not have unexpected modifiers.
 *
 * @param event a mouse wheel event to check for validity
 * @return {@code true} if the specified event is valid, {@code false} otherwise
 */
public static boolean isScrollEvent(@Nonnull MouseWheelEvent event) {
  if (event.isConsumed()) return false; // event should not be consumed already
  if (event.getWheelRotation() == 0) return false; // any rotation expected (forward or backward)
  return 0 == (SCROLL_MODIFIERS & event.getModifiers());
}