Package java.awt.event

Examples of java.awt.event.MouseWheelEvent


    public boolean handlesWheelScrolling() {return true;}

    public void handleEvent(AWTEvent e) {
        if (e.getID() == MouseEvent.MOUSE_WHEEL) {
            MouseWheelEvent mwe = (MouseWheelEvent)e;
            nativeHandleMouseWheel(mwe.getScrollType(),
                                   mwe.getScrollAmount(),
                                   mwe.getWheelRotation());
        }
        else {
            super.handleEvent(e);
        }
    }
View Full Code Here


        if (check.getID() == event.getID()
            && check.getKeyCode() == event.getKeyCode())
          return;
      } else if (ch instanceof MouseWheelEvent
          && ev instanceof MouseWheelEvent) {
        MouseWheelEvent event = (MouseWheelEvent) ev;
        MouseWheelEvent check = (MouseWheelEvent) ch;

        if (check.getID() == event.getID()
            && check.getScrollAmount() == event.getScrollAmount())
          return;
      } else if (ch instanceof MouseEvent && ev instanceof MouseEvent) {
        MouseEvent event = (MouseEvent) ev;
        MouseEvent check = (MouseEvent) ch;

        if (check.getID() == event.getID()
            && check.getButton() == event.getButton())
          return;
      } else
        return;
    }
    inputEvents.add(ev);
View Full Code Here

                                                    id,
                                                    x,
                                                    y,
                                                    ((SunDropTargetEvent)e).getDispatcher());
            } else if (id == MouseEvent.MOUSE_WHEEL) {
                retargeted = new MouseWheelEvent(target,
                                      id,
                                       e.getWhen(),
                                       e.getModifiersEx() | e.getModifiers(),
                                       x,
                                       y,
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            if (".".equals(action) || ",".equals(action)) {
                Point mouse = nc.getMousePosition();
                if (mouse == null)
                    mouse = new Point((int)nc.getBounds().getCenterX(), (int)nc.getBounds().getCenterY());
                MouseWheelEvent we = new MouseWheelEvent(nc, e.getID(), e.getWhen(), e.getModifiers(), mouse.x, mouse.y, 0, false,
                        MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, ",".equals(action) ? -1 : 1);
                mouseWheelMoved(we);
            } else {
                EastNorth center = nc.getCenter();
                EastNorth newcenter = nc.getEastNorth(nc.getWidth()/2+nc.getWidth()/5, nc.getHeight()/2+nc.getHeight()/5);
View Full Code Here

     */
    @Test
    public void testMouseWheelMoved() {
        ZoomSlider zs = new ZoomSlider(250, 70, true);

        MouseWheelEvent wheelDown = new MouseWheelEvent(zs, 0, System
                .currentTimeMillis(), 0, 100, 30, 0, false,
                MouseWheelEvent.WHEEL_UNIT_SCROLL, 20, 20);
        MouseWheelEvent wheelUp = new MouseWheelEvent(zs, 0, System
                .currentTimeMillis(), 0, 100, 30, 0, false,
                MouseWheelEvent.WHEEL_UNIT_SCROLL, -20, -20);

        int value = zs.getValue();
        zs.mouseWheelMoved(wheelUp);
        assertTrue("scroll up reduce zoom " + value + " > " + zs.getValue()
                + " " + wheelUp.getPreciseWheelRotation(), value > zs
                .getValue());

        value = zs.getValue();
        zs.mouseWheelMoved(wheelDown);
        assertTrue("scroll down increase zoom " + value + " < " + zs.getValue()
View Full Code Here

      }
      MouseEvent me;
      if(Utils.IS_JAVA_6_OR_GREATER) {
        // Not specifying the absX and Y in Java 6 results in a deadlock when pressing alt+F4 while moving the mouse over a native control
        if(type == MouseEvent.MOUSE_WHEEL) {
          me = new MouseWheelEvent(nativeComponent, type, System.currentTimeMillis(), SWTUtils.translateSWTModifiers(e_stateMask), e_x, e_y, e_cursorLocation.x, e_cursorLocation.y, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, Math.abs(e_count), e_count < 0? 1: -1);
        } else {
          boolean isPopupTrigger = type == MouseEvent.MOUSE_RELEASED && button == MouseEvent.BUTTON3;
          me = new MouseEvent(nativeComponent, type, System.currentTimeMillis(), SWTUtils.translateSWTModifiers(e_stateMask), e_x, e_y, e_cursorLocation.x, e_cursorLocation.y, e_count, isPopupTrigger, button);
        }
      } else {
        if(type == MouseEvent.MOUSE_WHEEL) {
          me = new MouseWheelEvent(nativeComponent, type, System.currentTimeMillis(), SWTUtils.translateSWTModifiers(e_stateMask), e_x, e_y, 0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, Math.abs(e_count), e_count < 0? 1: -1);
        } else {
          boolean isPopupTrigger = type == MouseEvent.MOUSE_RELEASED && button == MouseEvent.BUTTON3;
          me = new MouseEvent(nativeComponent, type, System.currentTimeMillis(), SWTUtils.translateSWTModifiers(e_stateMask), e_x, e_y, e_count, isPopupTrigger, button);
        }
      }
View Full Code Here

        toTest.mouseWheelMoved(null);
    }

    @Test
    public void passesEventsToHandlers() {
        MouseWheelEvent evt = mock(MouseWheelEvent.class);
        toTest.mouseDragged(evt);
        toTest.mouseMoved(evt);
        toTest.mouseClicked(evt);
        toTest.mousePressed(evt);
        toTest.mouseReleased(evt);
View Full Code Here

            int         modifiers       = mouseEvent.getModifiers();
            int         clickCount      = mouseEvent.getClickCount();
            boolean     isPopupTrigger  = mouseEvent.isPopupTrigger();
            MouseEvent newEvent;
            if(id == MouseEvent.MOUSE_WHEEL) {
                MouseWheelEvent mouseWheelEvent = (MouseWheelEvent) mouseEvent;
                int             scrollType = mouseWheelEvent.getScrollType();
                int             scrollAmount = mouseWheelEvent.getScrollAmount();
                int             wheelRotation = mouseWheelEvent.getWheelRotation();
                newEvent = new MouseWheelEvent(parentComponent, id, when, modifiers, point.x, point.y,
                        clickCount, isPopupTrigger, scrollType, scrollAmount,
                        wheelRotation);
            }
            else {
                newEvent = new MouseEvent(parentComponent, id, when, modifiers, point.x, point.y,
View Full Code Here

TOP

Related Classes of java.awt.event.MouseWheelEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.