Package java.awt.event

Examples of java.awt.event.MouseEvent


  @Test
  public void should_not_update_for_unrecognized_events() {
    info.source(source);
    info.origin(origin);
    JComboBox c = comboBox().createNew();
    MouseEvent event = new MouseEvent(c, eventMask, when, 0, 0, 0, 1, false, BUTTON1);
    info.update(event);
    assertThat(info.source()).isSameAs(source);
    assertThat(info.origin()).isEqualTo(origin);
  }
View Full Code Here


*/
public class DragDropInfo_update_Test extends DragDropInfo_TestCase {

  @Test
  public void should_update_source_and_x_y_coordinates_on_mouse_pressed() {
    MouseEvent event = new MouseEvent(source, MOUSE_PRESSED, when, 0, origin.x, origin.y, 1, false, BUTTON1);
    info.update(event);
    assertThat(info.source()).isSameAs(source);
    assertThat(info.origin()).isEqualTo(origin);
  }
View Full Code Here

  @Test
  public void should_clear_source_on_mouse_released() {
    info.source(source);
    info.origin(origin);
    JComboBox c = comboBox().createNew();
    MouseEvent event = new MouseEvent(c, MOUSE_RELEASED, when, 0, 7, 9, 1, false, BUTTON1);
    info.update(event);
    assertThat(info.source()).isNull();
  }
View Full Code Here

  @Test
  public void should_clear_source_on_mouse_moved() {
    info.source(source);
    info.origin(origin);
    JComboBox c = comboBox().createNew();
    MouseEvent event = new MouseEvent(c, MOUSE_MOVED, when, 0, 7, 9, 1, false, BUTTON1);
    info.update(event);
    assertThat(info.source()).isNull();
  }
View Full Code Here

  @Override
  protected void dispatchEvent(AWTEvent e) {
    // TODO: implement enter/exit events
    // TODO: change source to drag source, not mouse under
    if (nativeDnd.isNativeDragAndDrop(e)) {
      MouseEvent mouseEvent = (MouseEvent) e;
      Component target = getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY());
      if (target != mouseEvent.getSource()) {
        mouseEvent = convertMouseEvent(mouseEvent.getComponent(), mouseEvent, target);
      }
      relayDndEvent(mouseEvent);
    }
    super.dispatchEvent(e);
  }
View Full Code Here

          modifiers(inputEvent.getModifiers());
          // FIXME add state of individual keys
        }
      }
      if (inputEvent instanceof MouseEvent) {
        MouseEvent mouseEvent = (MouseEvent) inputEvent;
        Point eventScreenLocation = screenLocation(mouseEvent);
        synchronized (this) {
          lastEventTime(mouseEvent);
          dragDropInfo.update(mouseEvent);
          mouseInfo.modifiers(modifiers);
View Full Code Here

    assertThat(dnd.isNativeDragAndDrop(e)).isFalse();
  }

  @Test
  public void should_return_false_if_event_class_name_is_not_SunDropTargetEvent() {
    MouseEvent e = new MouseEvent(label().createNew(), 0, 0, 0, 0, 0, 0, false);
    assertThat(dnd.isNativeDragAndDrop(e)).isFalse();
  }
View Full Code Here

  int x = awtEvent.getX();
  int y = awtEvent.getY();
  long when = awtEvent.getWhen();
  int modifiers = awtEvent.getModifiers();
  int button = awtEvent.getButton();
  MouseEvent me = new MouseEvent(dummyButton, id, when, modifiers, x, y, 0, false, button);
  return (MouseEnterExitEvent3D) createWonderlandEvent(me);
    }
View Full Code Here

     * of the drag start (mouse button press) point.
     * @param ret An Vector3f in which to store the drag vector. If null a new vector is created.
     * @return The argument ret is returned. If it was null a new vector is returned.
     */
    public Vector3f getDragVectorWorld (Vector3f dragStartWorld, Point dragStartScreen, Vector3f ret) {
        MouseEvent me = (MouseEvent) awtEvent;
  return getDragVectorWorld(me.getX(), me.getY(), dragStartWorld, dragStartScreen, ret);
    }
View Full Code Here

       
            int onmask = MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.SHIFT_DOWN_MASK;
            for (Event e : events) {
                if (e instanceof MouseButtonEvent3D) {
                    MouseButtonEvent3D mbe = (MouseButtonEvent3D)e;
                    MouseEvent awt = (MouseEvent) mbe.getAwtEvent();
                    if (awt.getID()== MouseEvent.MOUSE_PRESSED && (awt.getModifiersEx() & onmask)==onmask ) {
                        lastMouseX = awt.getX();
                        lastMouseY = awt.getY();
                    }
                } else if (e instanceof MouseDraggedEvent3D) {
                    MouseEvent3D me = (MouseEvent3D)e;
                    MouseEvent awtMe = (MouseEvent)me.getAwtEvent();
                    if (awtMe.getID() == MouseEvent.MOUSE_DRAGGED && (awtMe.getModifiersEx() & onmask)==onmask ) {
                        processRotations(me);
                        updateRotations = true;
                    }
                } else if (e instanceof KeyEvent3D) {
                    KeyEvent3D ke = (KeyEvent3D)e;
View Full Code Here

TOP

Related Classes of java.awt.event.MouseEvent

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.