Java 8 MouseWheelEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MouseWheelEvent class.

This code example shows how to use the following methods:getScrollAmount, getScrollType, getWheelRotation
This code example shows how to use the following methods:getModifiers, getClickCount, getPoint, getScrollAmount, getScrollType
  public void mouseWheelMoved(MouseWheelEvent e)
  { 
    if(getRoot() == null) 
      return; 
 
    final Panel panel = panelFor(e.getPoint());
    new limelight.ui.events.panel.MouseWheelEvent(e.getModifiers(), e.getPoint(), e.getClickCount(), e.getScrollType(), e.getScrollAmount(), e.getWheelRotation()).dispatch(panel);
  } 
 
  private void transition(Panel panel, MouseEvent e)
  { 
    if(hooveredPanel == null)
    { 
      new MouseEnteredEvent(e.getModifiers(), e.getPoint(), e.getClickCount()).dispatch(panel);
      enter(panel, panel, e);
    } 
    else if(hooveredPanel.isDescendantOf(panel))
      exit(hooveredPanel, panel, e);
    else if(panel.isDescendantOf(hooveredPanel))
      enter(panel, hooveredPanel, e);
7
CodeRank
This code example shows how to use the following methods:getScrollAmount, getScrollType, getWheelRotation
    } 
 
    class BrowserMouseWheelHandler implements MouseWheelListener {
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (scrollpane.isWheelScrollingEnabled() &&
                e.getScrollAmount() != 0) {
                JScrollBar toScroll = scrollpane.getVerticalScrollBar();
                int direction;
                // find which scrollbar to scroll, or return if none 
                if (toScroll == null || !toScroll.isVisible()) {
                    toScroll = scrollpane.getHorizontalScrollBar();
                    if (toScroll == null || !toScroll.isVisible()) {
                        return; 
                    } 
                } 
                direction = e.getWheelRotation() < 0 ? -1 : 1;
                if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                    // For Windows, lock the scrollAmount to 1 
                    scrollByUnits(toScroll, direction, 1 /*e.getScrollAmount()*/);
                    // System.out.println("scrollByUnits " + direction + " " + e.getScrollAmount()); 

6
CodeRank
This code example shows how to use the following methods:isAltDown, isControlDown, isShiftDown, getScrollType, getWheelRotation
	 * Determines the value of the z-section. 
	 * @see MouseWheelListener#mouseWheelMoved(MouseWheelEvent) 
	 */ 
	public void mouseWheelMoved(MouseWheelEvent e)
	{ 
		if (e.isAltDown() || e.isShiftDown() || e.isControlDown() ||
			model.isBigImage()) { //zooming
			if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
				int v = e.getWheelRotation();
				model.zoom(v < 0); //zoom in and out.
			} 
			return; 
		} 
		//change the z-section. 
		int maxZ = model.getMaxZ();
		int maxT = model.getMaxT();
		if (maxZ <= 0 && maxT <= 0) return;
		boolean up = true;
        if (e.getWheelRotation() > 0) up = false;
        if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {

6
CodeRank
This code example shows how to use the following methods:getScrollAmount, getScrollType, getWheelRotation
        int modifiers = e.getModifiers( );
        int local_x = e.getX( ) - bounds.getX( );
        int local_y = e.getY( ) - ( parentHeight - ( bounds.getY( ) + bounds.getHeight( ) ) );
        int clickCount = e.getClickCount( );
        boolean popupTrigger = e.isPopupTrigger( );
        int scrollType = wheelEvent.getScrollType( );
        int scrollAmount = wheelEvent.getScrollAmount( );
        int wheelRotation = wheelEvent.getWheelRotation( );
 
        MouseWheelEvent localEvent = new GlimpseSwingMouseWheelEvent( stack, source, id, when, modifiers, local_x, local_y, clickCount, popupTrigger, scrollType, scrollAmount, wheelRotation );
 
        return localEvent;
    } 
 
    protected GlimpseMouseEvent toGlimpseEvent( MouseEvent e )
    { 
        return GlimpseMouseWrapper.fromMouseEvent( e );
    } 
 
    protected GlimpseMouseEvent toGlimpseEventWheel( MouseEvent e )
6
CodeRank
This code example shows how to use the following methods:getComponent, getPoint, getWheelRotation
     
    /** 
     * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent) 
     */ 
    public void mouseWheelMoved(MouseWheelEvent e) {
        Display display = (Display)e.getComponent();
        if(atPointer) m_point = e.getPoint();
        else { 
        	m_point.x = display.getWidth()/2;
        	m_point.y = display.getHeight()/2;
        } 
        if(inverted) zoom(display, m_point, 1 - 0.1f * e.getWheelRotation(), false);
        else zoom(display, m_point, 1 + 0.1f * e.getWheelRotation(), false);
    } 
     
} // end of class WheelZoomControl 
6
CodeRank
This code example shows how to use the following methods:consume, getPoint, getWheelRotation, getSource
    /** 
	 * zoom the display in or out, depending on the direction of the 
	 * mouse wheel motion. 
	 */ 
	public void mouseWheelMoved(MouseWheelEvent e) {
        boolean accepted = checkModifiers(e);
        if(accepted == true) {
            VisualizationViewer vv = (VisualizationViewer)e.getSource();
            Point2D mouse = e.getPoint();
            Point2D center = vv.getCenter();
            int amount = e.getWheelRotation();
            if(zoomAtMouse) {
                if(amount > 0) {
                    scaler.scale(vv, in, mouse);
                } else if(amount < 0) {
                    scaler.scale(vv, out, mouse);
                } 
            } else { 
                if(amount > 0) {
                    scaler.scale(vv, in, center);

6
CodeRank
This code example shows how to use the following methods:isAltDown, isMetaDown, isShiftDown, getX, getY
 
	/** 
	 * Zooms in or out using mouse wheel 
	 */ 
	public void mouseWheelMoved(MouseWheelEvent e) {
		wrapMouseWheelMoved(e.getX(), e.getY(), e.getWheelRotation(),
				e.isShiftDown() || e.isMetaDown(), e.isAltDown());
	} 
 
	public void addListenersTo(Component evjpanel) {
		evjpanel.addMouseMotionListener(this);
		evjpanel.addMouseListener(this);
		evjpanel.addMouseWheelListener(this);
		evjpanel.addComponentListener(this);
	} 
 
	@Override 
	public boolean refreshHighlighting(Hits hits, boolean control) {
 
		if (AppD.getShiftDown()) 
6
CodeRank
This code example shows how to use the following methods:isAltDown, isMetaDown, isShiftDown, getX, getY
 
	/** 
	 * Zooms in or out using mouse wheel 
	 */ 
	public void mouseWheelMoved(MouseWheelEvent e) {
		wrapMouseWheelMoved(e.getX(), e.getY(),e.getWheelRotation(),
				e.isShiftDown() || e.isMetaDown(), e.isAltDown());
	} 
	 
	 
	public void addListenersTo(Component evjpanel){
		evjpanel.addMouseMotionListener(this);
		evjpanel.addMouseListener(this);
		evjpanel.addMouseWheelListener(this);
		evjpanel.addComponentListener(this);
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:getX, getY, getWheelRotation
     * Zoom the map by 1/5th of current zoom per wheel-delta. 
     * @param e The wheel event. 
     */ 
    @Override 
    public void mouseWheelMoved(MouseWheelEvent e) {
        nc.zoomToFactor(e.getX(), e.getY(), Math.pow(Math.sqrt(2), e.getWheelRotation()));
    } 
 
    /** 
     * Emulates dragging on Mac OSX. 
     */ 
    @Override 
    public void mouseMoved(MouseEvent e) {
        if (!movementInPlace)
            return; 
        // Mac OSX simulates with  ctrl + mouse 1  the second mouse button hence no dragging events get fired. 
        // Is only the selected mouse button pressed? 
        if (Main.isPlatformOsx()) { 
            if (e.getModifiersEx() == MouseEvent.CTRL_DOWN_MASK) {
                if (mousePosMove == null) {
6
CodeRank
See Code Examples for Java 8 MouseWheelEvent Methods: