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

The following examples show how to use java.awt.event.MouseWheelEvent#getWhen() . 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: Input.java    From lizzie with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
  if (Lizzie.frame.processCommentMouseWheelMoved(e)) {
    return;
  }
  if (e.getWhen() - wheelWhen > 0) {
    wheelWhen = e.getWhen();
    if (Lizzie.board.inAnalysisMode()) Lizzie.board.toggleAnalysis();
    if (e.getWheelRotation() > 0) {
      if (Lizzie.frame.isMouseOver) {
        Lizzie.frame.doBranch(1);
      } else {
        redo();
      }
    } else if (e.getWheelRotation() < 0) {
      if (Lizzie.frame.isMouseOver) {
        Lizzie.frame.doBranch(-1);
      } else {
        undo();
      }
    }
    Lizzie.frame.refresh();
  }
}
 
Example 2
Source File: TranslateMouseWheelListener.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
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 3
Source File: MouseEventUI.java    From darklaf with MIT License 5 votes vote down vote up
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 4
Source File: TranslateMouseWheelListener.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 5
Source File: WebViewPanel.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
@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 6
Source File: GuiUtil.java    From CQL with GNU Affero General Public License v3.0 4 votes vote down vote up
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 7
Source File: CustomScrollPane.java    From PacketProxy with Apache License 2.0 4 votes vote down vote up
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 8
Source File: PDControlScrollPane.java    From Decoder-Improved with GNU General Public License v3.0 4 votes vote down vote up
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 9
Source File: MouseWheelController.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
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());
}