Java Code Examples for java.awt.event.MouseWheelEvent#getClickCount()
The following examples show how to use
java.awt.event.MouseWheelEvent#getClickCount() .
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: TranslateMouseWheelListener.java From plugins with GNU General Public License v3.0 | 5 votes |
private MouseWheelEvent translateEvent(MouseWheelEvent e) { Dimension stretchedDimensions = client.getStretchedDimensions(); Dimension realDimensions = client.getRealDimensions(); int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth())); int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight())); return new MouseWheelEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), newX, newY, e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation()); }
Example 2
Source File: MouseEventUI.java From darklaf with MIT License | 5 votes |
private MouseWheelEvent createMouseWheelEvent(final MouseWheelEvent mouseWheelEvent, final Point point, final Component target) { return new MouseWheelEvent(target, mouseWheelEvent.getID(), mouseWheelEvent.getWhen(), mouseWheelEvent.getModifiersEx(), point.x, point.y, mouseWheelEvent.getClickCount(), mouseWheelEvent.isPopupTrigger(), mouseWheelEvent.getScrollType(), mouseWheelEvent.getScrollAmount(), mouseWheelEvent.getWheelRotation()); }
Example 3
Source File: UIUtilities.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Clones a {@link MouseEvent}. * * @param event The event to clone. * @return The new {@link MouseEvent}. */ public static final MouseEvent cloneMouseEvent(MouseEvent event) { if (event instanceof MouseWheelEvent) { MouseWheelEvent old = (MouseWheelEvent) event; return new MouseWheelEvent((Component) old.getSource(), old.getID(), System.currentTimeMillis(), old.getModifiersEx(), old.getX(), old.getY(), old.getClickCount(), old.isPopupTrigger(), old.getScrollType(), old.getScrollAmount(), old.getWheelRotation()); } return new MouseEvent((Component) event.getSource(), event.getID(), System.currentTimeMillis(), event.getModifiersEx(), event.getX(), event.getY(), event.getClickCount(), event.isPopupTrigger()); }
Example 4
Source File: UIUtilities.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** * Clones a {@link MouseEvent}. * * @param event The event to clone. * @param refreshTime Pass in {@code true} to generate a new time stamp. * @return The new {@link MouseEvent}. */ public static final MouseEvent cloneMouseEvent(MouseEvent event, boolean refreshTime) { if (event instanceof MouseWheelEvent) { MouseWheelEvent old = (MouseWheelEvent) event; return new MouseWheelEvent((Component) old.getSource(), old.getID(), refreshTime ? System.currentTimeMillis() : event.getWhen(), old.getModifiersEx(), old.getX(), old.getY(), old.getClickCount(), old.isPopupTrigger(), old.getScrollType(), old.getScrollAmount(), old.getWheelRotation()); } return new MouseEvent((Component) event.getSource(), event.getID(), refreshTime ? System.currentTimeMillis() : event.getWhen(), event.getModifiersEx(), event.getX(), event.getY(), event.getClickCount(), event.isPopupTrigger()); }
Example 5
Source File: TranslateMouseWheelListener.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private MouseWheelEvent translateEvent(MouseWheelEvent e) { Dimension stretchedDimensions = client.getStretchedDimensions(); Dimension realDimensions = client.getRealDimensions(); int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth())); int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight())); return new MouseWheelEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), newX, newY, e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation()); }
Example 6
Source File: GroundContainer.java From stendhal with GNU General Public License v2.0 | 5 votes |
@Override public void mouseWheelMoved(MouseWheelEvent e) { if (User.isNull()) { return; } /* * Turning with mouse wheel. Ignore all but the first to avoid flooding * the server with turn commands. */ logger.debug(e.getClickCount() + " click count and " + e.getScrollType() + " scroll type and wheel rotation " + e.getWheelRotation()); if (e.getClickCount() <= 1) { final User user = User.get(); Direction currentDirection = user.getDirection(); Direction newDirection = null; if (e.getUnitsToScroll() > 0) { // Turn right newDirection = currentDirection.nextDirection(); } else { // Turn left newDirection = currentDirection.nextDirection().oppositeDirection(); } if (newDirection != null && newDirection != currentDirection) { final RPAction turnAction = new RPAction(); turnAction.put(TYPE, FACE); turnAction.put(DIR, newDirection.get()); client.send(turnAction); } } }
Example 7
Source File: WebViewPanel.java From wandora with GNU General Public License v3.0 | 5 votes |
@Override protected void processMouseWheelEvent(MouseWheelEvent e) { MouseWheelEvent ee = new MouseWheelEvent( (Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation(), e.getPreciseWheelRotation()); super.processMouseWheelEvent(ee); }
Example 8
Source File: GuiUtil.java From CQL with GNU Affero General Public License v3.0 | 4 votes |
private MouseWheelEvent cloneEvent(MouseWheelEvent e) { return new MouseWheelEvent(getParentScrollPane(), e.getID(), e.getWhen(), e.getModifiers(), 1, 1, e.getClickCount(), false, e.getScrollType(), e.getScrollAmount(), e.getWheelRotation()); }
Example 9
Source File: CustomScrollPane.java From PacketProxy with Apache License 2.0 | 4 votes |
private MouseWheelEvent cloneEvent(MouseWheelEvent e) { return new MouseWheelEvent(getParentScrollPane(), e.getID(), e .getWhen(), e.getModifiers(), 1, 1, e .getClickCount(), false, e.getScrollType(), e .getScrollAmount(), e.getWheelRotation()); }
Example 10
Source File: PDControlScrollPane.java From Decoder-Improved with GNU General Public License v3.0 | 4 votes |
private MouseWheelEvent cloneEvent(MouseWheelEvent e) { return new MouseWheelEvent(getParentScrollPane(), e.getID(), e .getWhen(), e.getModifiersEx(), 1, 1, e .getClickCount(), false, e.getScrollType(), e .getScrollAmount(), e.getWheelRotation()); }
Example 11
Source File: MouseWheelController.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
private MouseWheelEvent createScrollAmountEvent(MouseWheelEvent e) { // Reset the scroll amount return new MouseWheelEvent(e.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getScrollType(), scrollAmount, e.getWheelRotation()); }
Example 12
Source File: UIUtilities.java From gcs with Mozilla Public License 2.0 | 3 votes |
/** * Clones a {@link MouseEvent}. * * @param event The event to clone. * @param source Pass in a new source. * @param where Pass in a new location. * @param refreshTime Pass in {@code true} to generate a new time stamp. * @return The new {@link MouseEvent}. */ public static final MouseEvent cloneMouseEvent(MouseEvent event, Component source, Point where, boolean refreshTime) { if (event instanceof MouseWheelEvent) { MouseWheelEvent old = (MouseWheelEvent) event; return new MouseWheelEvent(source, old.getID(), refreshTime ? System.currentTimeMillis() : event.getWhen(), old.getModifiersEx(), where.x, where.y, old.getClickCount(), old.isPopupTrigger(), old.getScrollType(), old.getScrollAmount(), old.getWheelRotation()); } return new MouseEvent(source, event.getID(), refreshTime ? System.currentTimeMillis() : event.getWhen(), event.getModifiersEx(), where.x, where.y, event.getClickCount(), event.isPopupTrigger()); }