java.awt.event

Class MouseEvent

Implemented Interfaces:
Serializable
Known Direct Subclasses:
MenuDragMouseEvent, MouseWheelEvent

public class MouseEvent
extends InputEvent

An event which indicates that a mouse action occurred in a component. A mouse action is considered to occur in a particular component if and only if the mouse cursor is over the unobscured part of the component's bounds when the action happens. Component bounds can be obscurred by the visible component's children or by a menu or by a top-level window. This event is used both for mouse events (click, enter, exit) and mouse motion events (moves and drags).

This low-level event is generated by a component object for:

  • Mouse Motion Events

    A MouseEvent object is passed to every MouseListener or MouseAdapter object which is registered to receive the "interesting" mouse events using the component's addMouseListener method. (MouseAdapter objects implement the MouseListener interface.) Each such listener object gets a MouseEvent containing the mouse event.

    A MouseEvent object is also passed to every MouseMotionListener or MouseMotionAdapter object which is registered to receive mouse motion events using the component's addMouseMotionListener method. (MouseMotionAdapter objects implement the MouseMotionListener interface.) Each such listener object gets a MouseEvent containing the mouse motion event.

    When a mouse button is clicked, events are generated and sent to the registered MouseListeners. The state of modal keys can be retrieved using InputEvent.getModifiers() and InputEvent.getModifiersEx(). The button mask returned by InputEvent.getModifiers() reflects only the button that changed state, not the current state of all buttons. (Note: Due to overlap in the values of ALT_MASK/BUTTON2_MASK and META_MASK/BUTTON3_MASK, this is not always true for mouse events involving modifier keys). To get the state of all buttons and modifier keys, use InputEvent.getModifiersEx(). The button which has changed state is returned by getButton()

    For example, if the first mouse button is pressed, events are sent in the following order:

        id              modifiers    button           
        MOUSE_PRESSED:  BUTTON1_MASK BUTTON1
        MOUSE_RELEASED: BUTTON1_MASK BUTTON1
        MOUSE_CLICKED:  BUTTON1_MASK BUTTON1
     
    When multiple mouse buttons are pressed, each press, release, and click results in a separate event.

    For example, if the user presses button 1 followed by button 2, and then releases them in the same order, the following sequence of events is generated:

        id              modifiers    button           
        MOUSE_PRESSED:  BUTTON1_MASK BUTTON1
        MOUSE_PRESSED:  BUTTON2_MASK BUTTON2
        MOUSE_RELEASED: BUTTON1_MASK BUTTON1
        MOUSE_CLICKED:  BUTTON1_MASK BUTTON1
        MOUSE_RELEASED: BUTTON2_MASK BUTTON2
        MOUSE_CLICKED:  BUTTON2_MASK BUTTON2
     
    If button 2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.

    MOUSE_DRAGGED events are delivered to the Component in which the mouse button was pressed until the mouse button is released (regardless of whether the mouse position is within the bounds of the Component). Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation. In a multi-screen environment mouse drag events are delivered to the Component even if the mouse position is outside the bounds of the GraphicsConfiguration associated with that Component. However, the reported position for mouse drag events in this case may differ from the actual mouse position:

  • Since:
    1.1
    See Also:
    MouseAdapter, MouseListener, MouseMotionAdapter, MouseMotionListener, MouseWheelListener, Tutorial: Writing a Mouse Listener, Tutorial: Writing a Mouse Motion Listener, Reference: The Java Class Libraries (update file), Serialized Form

    Field Summary

    static int
    BUTTON1
    Indicates mouse button #1; used by getButton().
    static int
    BUTTON2
    Indicates mouse button #2; used by getButton().
    static int
    BUTTON3
    Indicates mouse button #3; used by getButton().
    static int
    MOUSE_CLICKED
    The "mouse clicked" event.
    static int
    MOUSE_DRAGGED
    The "mouse dragged" event.
    static int
    MOUSE_ENTERED
    The "mouse entered" event.
    static int
    MOUSE_EXITED
    The "mouse exited" event.
    static int
    MOUSE_FIRST
    The first number in the range of ids used for mouse events.
    static int
    MOUSE_LAST
    The last number in the range of ids used for mouse events.
    static int
    MOUSE_MOVED
    The "mouse moved" event.
    static int
    MOUSE_PRESSED
    The "mouse pressed" event.
    static int
    MOUSE_RELEASED
    The "mouse released" event.
    static int
    MOUSE_WHEEL
    The "mouse wheel" event.
    static int
    NOBUTTON
    Indicates no mouse buttons; used by getButton().

    Fields inherited from class java.awt.event.InputEvent

    ALT_DOWN_MASK, ALT_GRAPH_DOWN_MASK, ALT_GRAPH_MASK, ALT_MASK, BUTTON1_DOWN_MASK, BUTTON1_MASK, BUTTON2_DOWN_MASK, BUTTON2_MASK, BUTTON3_DOWN_MASK, BUTTON3_MASK, CTRL_DOWN_MASK, CTRL_MASK, META_DOWN_MASK, META_MASK, SHIFT_DOWN_MASK, SHIFT_MASK

    Fields inherited from class java.awt.event.ComponentEvent

    COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN

    Fields inherited from class java.awt.AWTEvent

    ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK, consumed, id

    Fields inherited from class java.util.EventObject

    source

    Constructor Summary

    MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger)
    Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.
    MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button)
    Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.

    Method Summary

    int
    getButton()
    Returns which, if any, of the mouse buttons has changed state.
    int
    getClickCount()
    Returns the number of mouse clicks associated with this event.
    static String
    getMouseModifiersText(int modifiers)
    Returns a String describing the modifier keys and mouse buttons that were down during the event, such as "Shift", or "Ctrl+Shift".
    Point
    getPoint()
    Returns the x,y position of the event relative to the source component.
    int
    getX()
    Returns the horizontal x position of the event relative to the source component.
    int
    getY()
    Returns the vertical y position of the event relative to the source component.
    boolean
    isPopupTrigger()
    Returns whether or not this mouse event is the popup menu trigger event for the platform.
    String
    paramString()
    Returns a parameter string identifying this event.
    void
    translatePoint(int x, int y)
    Translates the event's coordinates to a new position by adding specified x (horizontal) and y (vertical) offsets.

    Methods inherited from class java.awt.event.InputEvent

    consume, getModifiers, getModifiersEx, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown

    Methods inherited from class java.awt.event.ComponentEvent

    getComponent, paramString

    Methods inherited from class java.awt.AWTEvent

    consume, getID, isConsumed, paramString, setSource, toString

    Methods inherited from class java.util.EventObject

    getSource, toString

    Methods inherited from class java.lang.Object

    clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

    Field Details

    BUTTON1

    public static final int BUTTON1
    Indicates mouse button #1; used by getButton().
    Field Value:
    1
    Since:
    1.4
    Usages and Demos :

    View More Examples of MouseEvent.BUTTON1
       1:         return new MouseEvent(panel, 0, 0, MouseEvent.BUTTON1_MASK, 
       2:                 x, y, 1, false, MouseEvent.BUTTON1);
       3:     }
       4: 
       5:     private Point p(PlugInContext context) {

    View Full Code Here
       1:                     {
       2:                     case MouseEvent.BUTTON1:
       3:                     }
       4:                 }
       5:             }

    View Full Code Here
       1:     if (
       2:       ev.getButton() == MouseEvent.BUTTON1 &&
       3:       ev.getID() == MouseEvent.MOUSE_CLICKED && ev.getClickCount() == 2) {
       4:       PickNodeMessage pickNodeMessage = new PickNodeMessage(pt);
       5:       pickNodeMessage.sendVO(this);

    View Full Code Here
       1:             case 1:
       2:                 return MouseEvent.BUTTON1;    
       3:             case 2:
       4:                 return MouseEvent.BUTTON2;
       5:             case 3:

    View Full Code Here
       1:   private boolean wasPressed(MouseEvent ev) {
       2:     return (ev.getButton() == MouseEvent.BUTTON1) &&
       3:     (ev.getID() == MouseEvent.MOUSE_PRESSED);
       4:         ...
       5:   private boolean wasReleased(MouseEvent ev) {
       6:     return (ev.getButton() == MouseEvent.BUTTON1) &&
       7:     (ev.getID() == MouseEvent.MOUSE_RELEASED);
       8:   }
       9: }

    View Full Code Here

    BUTTON2

    public static final int BUTTON2
    Indicates mouse button #2; used by getButton().
    Field Value:
    2
    Since:
    1.4
    Usages and Demos :

    View More Examples of MouseEvent.BUTTON2
       1:             case 2:
       2:                 return MouseEvent.BUTTON2;
       3:             case 3:
       4:                 return MouseEvent.BUTTON3;
       5:             default:

    View Full Code Here
       1:         break;
       2:     case MouseEvent.BUTTON2:
       3:         setMouseButton2(true);
       4:         ...
       5:         break;
       6:     case MouseEvent.BUTTON2:
       7:         setMouseButton2(false);
       8:         break;
       9:     case MouseEvent.BUTTON3:

    View Full Code Here
       1:                 return MOUSE_BUTTON_1;
       2:             case MouseEvent.BUTTON2:
       3:                 return MOUSE_BUTTON_2;
       4:             case MouseEvent.BUTTON3:
       5:                 return MOUSE_BUTTON_3;

    View Full Code Here
       1:                     else if ((e.getModifiers() & MouseEvent.BUTTON2_MASK) == MouseEvent.BUTTON2_MASK) {
       2:                         e = new MouseEvent((Component)e.getSource(),MouseEvent.MOUSE_PRESSED,e.getWhen(),e.getModifiers(),e.getX(),e.getY(),e.getClickCount(),e.isPopupTrigger(),MouseEvent.BUTTON2);
       3:                     }
       4:         ...
       5:                         
       6:                     case MouseEvent.BUTTON2:
       7:                         if (isButton2Pressed) {
       8:         ...
       9:                     else if ((e.getModifiers() & MouseEvent.BUTTON2_MASK) == MouseEvent.BUTTON2_MASK) {
      10:                         e = new MouseEvent((Component)e.getSource(),MouseEvent.MOUSE_RELEASED,e.getWhen(),e.getModifiers(),e.getX(),e.getY(),e.getClickCount(),e.isPopupTrigger(),MouseEvent.BUTTON2);
      11:                     }

    View Full Code Here

    BUTTON3

    public static final int BUTTON3
    Indicates mouse button #3; used by getButton().
    Field Value:
    3
    Since:
    1.4
    Usages and Demos :

    View More Examples of MouseEvent.BUTTON3
       1:     private int margin;
       2:     private int mouseButton = MouseEvent.BUTTON3;
       3:     
       4:     public ZoomToFitControl() {
       5:         this(50);

    View Full Code Here
       1:                     {
       2:                     case MouseEvent.BUTTON3:
       3:                         JPopupMenu popup = new CommunityPopupMenu(comunidade);
       4:                         popup.show(table, e.getX(), e.getY());
       5:                     }

    View Full Code Here
       1:             case 3:
       2:                 return MouseEvent.BUTTON3;
       3:             default:
       4:                 return MouseEvent.NOBUTTON;
       5:         }

    View Full Code Here
       1:         break;
       2:     case MouseEvent.BUTTON3:
       3:         setMouseButton3(true);
       4:         ...
       5:         break;
       6:     case MouseEvent.BUTTON3:
       7:         setMouseButton3(false);
       8:         break;
       9:     }

    View Full Code Here
       1:             break;
       2:         case MouseEvent.BUTTON3:
       3:             int row = tableMeusAmigos.rowAtPoint(e.getPoint());
       4:             if (row >= 0) {
       5:                 if ((tableMeusAmigos.getSelectedRowCount() == 0)

    View Full Code Here

    MOUSE_CLICKED

    public static final int MOUSE_CLICKED
    The "mouse clicked" event. This MouseEvent occurs when a mouse button is pressed and released.
    Field Value:
    500
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_CLICKED
       1:         case MouseEvent.MOUSE_EXITED:        return 1;
       2:         case MouseEvent.MOUSE_CLICKED:        return 2;
       3:         case MouseEvent.MOUSE_PRESSED:        return 3;
       4:         case MouseEvent.MOUSE_RELEASED:        return 4;
       5:         case MouseEvent.MOUSE_MOVED:        return 5;

    View Full Code Here
       1:        assertFalse(action.clicked);
       2:        testMouseLabel.processMouseEvent(new MouseEvent(testMouseLabel, MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, 1, false));
       3:        assertTrue(action.clicked);
       4:     }
       5:         

    View Full Code Here
       1:                 case MouseEvent.MOUSE_RELEASED:
       2:                 case MouseEvent.MOUSE_CLICKED:
       3:                     break;
       4:                 case MouseEvent.MOUSE_ENTERED:
       5:                 case MouseEvent.MOUSE_EXITED:

    View Full Code Here
       1:         dispatchComponent.dispatchEvent(e2); 
       2:         e2 = new MouseEvent( dispatchComponent, MouseEvent.MOUSE_CLICKED,
       3:             e.getWhen() + 100001, e.getModifiers(), 3, 3, 1,
       4:             e.isPopupTrigger() );
       5:         dispatchComponent.dispatchEvent(e2);

    View Full Code Here

    MOUSE_DRAGGED

    public static final int MOUSE_DRAGGED
    The "mouse dragged" event. This MouseEvent occurs when the mouse position changes while a mouse button is pressed.
    Field Value:
    506
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_DRAGGED
       1:         case MouseEvent.MOUSE_MOVED:        return 5;
       2:         case MouseEvent.MOUSE_DRAGGED:        return 6;
       3:         }
       4:         throw new IllegalArgumentException();
       5:     }

    View Full Code Here
       1:     this(source,
       2:          new MouseEvent(tab, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), 0, point.x, point.y, 0, false));
       3:   }
       4: 
       5:   public TabDragEvent(Object source, MouseEvent mouseEvent) {

    View Full Code Here
       1: 
       2:     draggedEventLoc1 = new MouseEvent( component, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), 0, 0, 0, 0, false );
       3:         ...
       4:     draggedEventLoc2 = new MouseEvent( component, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), 0, 10, 10, 0, false );
       5:         ...
       6:     draggedEventLoc3 = new MouseEvent( component, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), 0, 20, 20, 0, false );
       7:     draggedEventLoc4 = new MouseEvent( component, MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), 0, 50, 50, 0, false );

    View Full Code Here
       1: 
       2:             case MouseEvent.MOUSE_DRAGGED:
       3:                 mouseDragged(event);
       4:                 break;
    

    View Full Code Here
       1:     switch(e.getID()) {
       2:       case MouseEvent.MOUSE_DRAGGED:
       3:         display.evnt[Display.MOUSE_MOVE] = 
       4:           "MOUSE dragged";
       5:         break;

    View Full Code Here

    MOUSE_ENTERED

    public static final int MOUSE_ENTERED
    The "mouse entered" event. This MouseEvent occurs when the mouse cursor enters the unobscured part of component's geometry.
    Field Value:
    504
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_ENTERED
       1:         switch (eventId) {
       2:         case MouseEvent.MOUSE_ENTERED:        return 0;
       3:         case MouseEvent.MOUSE_EXITED:        return 1;
       4:         case MouseEvent.MOUSE_CLICKED:        return 2;
       5:         case MouseEvent.MOUSE_PRESSED:        return 3;

    View Full Code Here
       1:                     break;
       2:                 case MouseEvent.MOUSE_ENTERED:
       3:                 case MouseEvent.MOUSE_EXITED:
       4:                     MouseEvent newEvt = new MouseEvent(
       5:                         this, e.getID(), e.getWhen(), e.getModifiers(),

    View Full Code Here
       1:             return handleMouseReleased(source, evt);
       2:         case MouseEvent.MOUSE_ENTERED:
       3:             return handleMouseClicked(source, evt);
       4:         case MouseEvent.MOUSE_EXITED:
       5:             return handleMouseExited(source, evt);

    View Full Code Here
       1:             break;
       2:           case MouseEvent.MOUSE_ENTERED:
       3:             break;
       4:           case MouseEvent.MOUSE_EXITED:
       5:             if(pressed == true) {

    View Full Code Here
       1:       super.processMouseEvent(
       2:           new MouseEvent(this, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, 0, 0, 0, false));
       3:   }
       4:         ...
       5:       super.processMouseEvent(
       6:           new MouseEvent(this, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, 0, 0, 0, false));
       7:     else
       8:         ...
       9:         super.processMouseEvent(
      10:             new MouseEvent(this, MouseEvent.MOUSE_ENTERED, System.currentTimeMillis(), 0, 0, 0, 0, false));
      11:       }

    View Full Code Here

    MOUSE_EXITED

    public static final int MOUSE_EXITED
    The "mouse exited" event. This MouseEvent occurs when the mouse cursor exits the unobscured part of component's geometry.
    Field Value:
    505
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_EXITED
       1:         case MouseEvent.MOUSE_ENTERED:        return 0;
       2:         case MouseEvent.MOUSE_EXITED:        return 1;
       3:         case MouseEvent.MOUSE_CLICKED:        return 2;
       4:         case MouseEvent.MOUSE_PRESSED:        return 3;
       5:         case MouseEvent.MOUSE_RELEASED:        return 4;

    View Full Code Here
       1: public abstract class ActionSpan extends Span {
       2:         eventAfter(new MouseEvent(br, MouseEvent.MOUSE_EXITED, System.currentTimeMillis(), 0, -1,-1, 1, false), new Point(-1,-1), getStart().leaf);
       3: 
       4:         br.releaseGrab(this);
       5:   protected abstract boolean action();

    View Full Code Here
       1:                 case MouseEvent.MOUSE_ENTERED:
       2:                 case MouseEvent.MOUSE_EXITED:
       3:                     MouseEvent newEvt = new MouseEvent(
       4:                         this, e.getID(), e.getWhen(), e.getModifiers(),
       5:                         e.getX(), e.getY(), e.getClickCount(),

    View Full Code Here
       1:             return handleMouseClicked(source, evt);
       2:         case MouseEvent.MOUSE_EXITED:
       3:             return handleMouseExited(source, evt);
       4:         }
       5:         return false;

    View Full Code Here
       1:             break;
       2:           case MouseEvent.MOUSE_EXITED:
       3:             if(pressed == true) {
       4:                 pressed = false;
    

    View Full Code Here

    MOUSE_FIRST

    public static final int MOUSE_FIRST
    The first number in the range of ids used for mouse events.
    Field Value:
    500
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_FIRST

    MOUSE_LAST

    public static final int MOUSE_LAST
    The last number in the range of ids used for mouse events.
    Field Value:
    507
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_LAST

    MOUSE_MOVED

    public static final int MOUSE_MOVED
    The "mouse moved" event. This MouseEvent occurs when the mouse position changes.
    Field Value:
    503
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_MOVED
       1:         case MouseEvent.MOUSE_RELEASED:        return 4;
       2:         case MouseEvent.MOUSE_MOVED:        return 5;
       3:         case MouseEvent.MOUSE_DRAGGED:        return 6;
       4:         }
       5:         throw new IllegalArgumentException();

    View Full Code Here
       1:         super.processMouseMotionEvent(
       2:             new MouseEvent(this, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, -1, -1, 0, false));
       3:       }
       4:         ...
       5:       super.processMouseMotionEvent(
       6:           new MouseEvent(this, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, xPos, yPos, 0, false));
       7:     }
       8:   }
    

    View Full Code Here
       1: 
       2:             case MouseEvent.MOUSE_MOVED:
       3:                 mouseMoved(event);
       4:                 break;
    

    View Full Code Here
       1:         break;
       2:       case MouseEvent.MOUSE_MOVED:
       3:         display.evnt[Display.MOUSE_MOVE] = 
       4:           "MOUSE moved";
       5:         break;

    View Full Code Here
       1:             switch(id) {
       2:             case MouseEvent.MOUSE_MOVED:
       3:                 layerMotionListener.mouseMoved(event);
       4:                 break;
       5:             case MouseEvent.MOUSE_EXITED:

    View Full Code Here

    MOUSE_PRESSED

    public static final int MOUSE_PRESSED
    The "mouse pressed" event. This MouseEvent occurs when a mouse button is pushed down.
    Field Value:
    501
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_PRESSED
       1: 
       2:     pressedEventLoc1 = new MouseEvent( component, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false );
       3:         ...
       4:     pressedEventLoc2 = new MouseEvent( component, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 10, 10, 1, false );
       5:         ...
       6:     pressedEventLoc3 = new MouseEvent( component, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 20, 20, 1, false );
       7:     pressedEventLoc4 = new MouseEvent( component, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 50, 50, 1, false );

    View Full Code Here
       1:       {
       2:          mouseEvents[0] = new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
       3:       }
       4:         ...
       5:          mouseEvents[0] = new WakeupOnBehaviorPost(this,
       6:              MouseEvent.MOUSE_PRESSED);
       7:          mouseq = new LinkedList<MouseEvent>();
       8:         ...
       9:    {
      10:       if (evt.getID() == MouseEvent.MOUSE_PRESSED)
      11:       {         

    View Full Code Here
       1:       {
       2:          mouseEvents[0] = new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
       3:          mouseEvents[1] = new WakeupOnAWTEvent(MouseEvent.MOUSE_RELEASED);
       4:         ...
       5:          mouseEvents[0] = new WakeupOnBehaviorPost(this,
       6:              MouseEvent.MOUSE_PRESSED);
       7:          mouseEvents[1] = new WakeupOnBehaviorPost(this,
       8:         ...
       9:    {
      10:       if (evt.getID() == MouseEvent.MOUSE_PRESSED)
      11:       {

    View Full Code Here
       1:                                 editor,
       2:                                 MouseEvent.MOUSE_PRESSED,
       3:                                 e.getWhen(),
       4:                                 e.getModifiers(),
       5:                                 (int) (e.getCanvasPosition().getX() - editor.getX()),

    View Full Code Here
       1:       drag = button;
       2:       MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
       3:                                      System.currentTimeMillis(), 0,
       4:                                      bp.event_x(), bp.event_y(),
       5:                                      1, false, button);

    View Full Code Here

    MOUSE_RELEASED

    public static final int MOUSE_RELEASED
    The "mouse released" event. This MouseEvent occurs when a mouse button is let up.
    Field Value:
    502
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_RELEASED
       1:     tool = new SelectionTool( canvas );
       2:     event = new MouseEvent( canvas.getComponent(), MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, 0, 0, 1, false );
       3: }
       4: public void testMouseReleased() {
       5:     tool.mouseReleased( event );

    View Full Code Here
       1:         MouseEvent e = (MouseEvent)anEvent;
       2:         MouseEvent e2 = new MouseEvent( dispatchComponent, MouseEvent.MOUSE_RELEASED,
       3:             e.getWhen() + 100000, e.getModifiers(), 3, 3, e.getClickCount(),
       4:             e.isPopupTrigger() );
       5:         dispatchComponent.dispatchEvent(e2); 

    View Full Code Here
       1: 
       2:     releasedEventLoc1 = new MouseEvent( component, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, 0, 0, 0, false );
       3:         ...
       4:     releasedEventLoc2 = new MouseEvent( component, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, 10, 10, 0, false );
       5:         ...
       6:     releasedEventLoc3 = new MouseEvent( component, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, 20, 20, 0, false );
       7:     releasedEventLoc4 = new MouseEvent( component, MouseEvent.MOUSE_RELEASED, System.currentTimeMillis(), 0, 50, 50, 0, false );

    View Full Code Here
       1:             MouseEvent e2 = new MouseEvent(dispatchComponent,
       2:                                            MouseEvent.MOUSE_RELEASED,
       3:                                            e.getWhen() + 100000,
       4:                                            e.getModifiers(), 3, 3,
       5:                                            e.getClickCount(), e.isPopupTrigger());

    View Full Code Here
       1:          mouseEvents[0] = new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
       2:          mouseEvents[1] = new WakeupOnAWTEvent(MouseEvent.MOUSE_RELEASED);
       3:       }
       4:         ...
       5:          mouseEvents[1] = new WakeupOnBehaviorPost(this,
       6:              MouseEvent.MOUSE_RELEASED);
       7:          mouseq = new LinkedList<MouseEvent>();
       8:         ...
       9:       }
      10:       if (evt.getID() == MouseEvent.MOUSE_RELEASED)
      11:       {

    View Full Code Here

    MOUSE_WHEEL

    public static final int MOUSE_WHEEL
    The "mouse wheel" event. This is the only MouseWheelEvent. It occurs when a mouse equipped with a wheel has its wheel rotated.
    Field Value:
    507
    Since:
    1.4
    Usages and Demos :

    View More Examples of MouseEvent.MOUSE_WHEEL
       1:     case MouseEvent.MOUSE_DRAGGED : mouseDragged (_evt); break;
       2:     case MouseEvent.MOUSE_WHEEL:
       3:       mouseWheelMoved((MouseWheelEvent)_evt);
       4:       break;
       5:     }

    View Full Code Here
       1:     {
       2:         case MouseEvent.MOUSE_WHEEL   : break;
       3:     case MouseEvent.MOUSE_PRESSED : activeCounter_++; break;
       4:     case MouseEvent.MOUSE_RELEASED: activeCounter_--; break;
       5:     case MouseEvent.MOUSE_ENTERED : activeCounter_++; break;

    View Full Code Here

    NOBUTTON

    public static final int NOBUTTON
    Indicates no mouse buttons; used by getButton().
    Field Value:
    0
    Since:
    1.4
    Usages and Demos :

    View More Examples of MouseEvent.NOBUTTON
       1:             default:
       2:                 return MouseEvent.NOBUTTON;
       3:         }
       4:     }
       5:     

    View Full Code Here
       1:     private transient PInputEvent dragEvent;
       2:     private transient int sequenceInitiatedButton = MouseEvent.NOBUTTON;
       3: 
       4:     public PDragSequenceEventHandler() {
       5:     }

    View Full Code Here

    Constructor Details

    MouseEvent

    public MouseEvent(Component source,
                      int id,
                      long when,
                      int modifiers,
                      int x,
                      int y,
                      int clickCount,
                      boolean popupTrigger)
    Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.

    Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

    Parameters:
    source - the Component that originated the event
    id - the integer that identifies the event
    when - a long int that gives the time the event occurred
    modifiers - the modifier keys down during event (e.g. shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
    x - the horizontal x coordinate for the mouse location
    y - the vertical y coordinate for the mouse location
    clickCount - the number of mouse clicks associated with event
    popupTrigger - a boolean, true if this event is a trigger for a popup menu
    Throws:
    IllegalArgumentException - if source is null
    Usages and Demos :

    View More Examples of MouseEvent(Component source,int id,long when,int modifiers,int x,int y,int clickCount,boolean popupTrigger)
       1:     protected void simulateEvent(int id, long when, int modifiers, int x, int y, int clickCount, boolean popuptrigger) {
       2:         processEvent(new MouseEvent(this, id, when, modifiers, x, y, clickCount, popuptrigger));
       3:     }
       4:     public boolean isShowingHorizontalScrollBar() {
       5:         return hbar.isShowing();

    View Full Code Here
       1:        assertFalse(action.clicked);
       2:        testMouseLabel.processMouseEvent(new MouseEvent(testMouseLabel, MouseEvent.MOUSE_CLICKED, 0, 0, 0, 0, 1, false));
       3:        assertTrue(action.clicked);
       4:     }
       5:         

    View Full Code Here
       1:         ToolTipManager.sharedInstance()
       2:                       .mousePressed(new MouseEvent(component, 0, 0, 0, 0, 0, 0, false));
       3:     }
       4: 
       5: }

    View Full Code Here
       1: 
       2:         dg.mouseClicked(new MouseEvent(dp.surface, MouseEvent.MOUSE_CLICKED, 0, 0, 10, 10, 1, false));
       3: 
       4:         try { thread.sleep(3333); } catch (Exception e) { return; }
    

    View Full Code Here
       1:                       Point p2 = SwingUtilities.convertPoint(top, p, c);
       2:                       eventDispatched(new MouseEvent(c, MouseEvent.MOUSE_ENTERED, 0, 0, p2.x, p2.y, 0, false));
       3:                     }
       4:                   }
       5:                 });

    View Full Code Here

    MouseEvent

    public MouseEvent(Component source,
                      int id,
                      long when,
                      int modifiers,
                      int x,
                      int y,
                      int clickCount,
                      boolean popupTrigger,
                      int button)
    Constructs a MouseEvent object with the specified source component, type, modifiers, coordinates, and click count.

    Note that passing in an invalid id results in unspecified behavior. Creating an invalid event (such as by using more than one of the old _MASKs, or modifier/button values which don't match) results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

    Parameters:
    source - the Component that originated the event
    id - the integer that identifies the event
    when - a long int that gives the time the event occurred
    modifiers - the modifier keys down during event (e.g. shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
    x - the horizontal x coordinate for the mouse location
    y - the vertical y coordinate for the mouse location
    clickCount - the number of mouse clicks associated with event
    popupTrigger - a boolean, true if this event is a trigger for a popup menu
    button - which of the mouse buttons has changed state. NOBUTTON, BUTTON1, BUTTON2 or BUTTON3.
    Throws:
    IllegalArgumentException - if an invalid button value is passed in
    IllegalArgumentException - if source is null
    Since:
    1.4

    Method Details

    getButton

    public int getButton()
    Returns which, if any, of the mouse buttons has changed state.
    Returns:
    one of the following constants: NOBUTTON, BUTTON1, BUTTON2 or BUTTON3.
    Since:
    1.4
    Usages and Demos :

    View More Examples of getButton()
       1: import java.awt.event.InputEvent;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: {
       6:     private final MouseEvent m_mouseEvent;
       7:     private final double m_x;
       8:         ...
       9: 
      10:     public MouseDetails(final MouseEvent mouseEvent, final double x, final double y)
      11:     {
      12:         ...
      13:     {
      14:         return m_mouseEvent.getButton();

    View Full Code Here
       1: import java.awt.*;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:   public static MouseEvent convert(MouseEvent event, Component newSource) {
       7:     return convert(event,
       8:         ...
       9:                           event.isPopupTrigger(),
      10:                           event.getButton());
      11:   }

    View Full Code Here
       1: 
       2: import java.awt.event.MouseEvent;
       3: import java.awt.geom.Point2D;
       4:         ...
       5:   @Override
       6:   public void callbackButton(Point2D pt, MouseEvent ev) {
       7:     if (
       8:         ...
       9:       ev.getButton() == MouseEvent.BUTTON1 &&
      10:         ...
      11:       ev.getID() == MouseEvent.MOUSE_CLICKED && ev.getClickCount() == 2) {

    View Full Code Here
       1:                     try {
       2:                         if(evt instanceof MouseEvent) {
       3:         ...
       4:                             MouseEvent me = (MouseEvent)evt;
       5:                             out.writeObject(me.getComponent().getName());
       6:         ...
       7:                     me.isPopupTrigger(),
       8:                     me.getButton()
       9:                     );

    View Full Code Here
       1: import java.awt.geom.Point2D;
       2: import java.awt.event.MouseEvent;
       3: import org.geotools.cs.CoordinateSystem;
       4:         ...
       5: 
       6: public final class GeoMouseEvent extends MouseEvent {
       7:     final MathTransform transform;
       8:         ...
       9:     public GeoMouseEvent(
      10:             final MouseEvent event,
      11:             final MathTransform transform)

    View Full Code Here

    getClickCount

    public int getClickCount()
    Returns the number of mouse clicks associated with this event.
    Returns:
    integer value for the number of clicks
    Usages and Demos :

    View More Examples of getClickCount()
       1: {    static int ID=0;
       2:     MouseEvent E;
       3:     
       4:         ...
       5:     public ListerMouseEvent (Object o, String name, MouseEvent e)
       6:     {    super(o,ID++,name);
       7:         ...
       8:     
       9:     public MouseEvent getEvent ()
      10:     {    return E;
      11:         ...
      12:     public int clickCount ()
      13:     {    return E.getClickCount();

    View Full Code Here
       1: 
       2:     MouseEvent translateMouseEv(MouseEvent e) {
       3:     int i=locationToIndex(new Point(e.getX(),e.getY()));
       4:         ...
       5:     Rectangle r=getCellBounds(i,i);
       6:     MouseEvent e2=new MouseEvent((Component) e.getSource(),
       7:                      e.getID(),
       8:         ...
       9:                      e.getY()-r.y,
      10:                      e.getClickCount(),
      11:                      e.isPopupTrigger());

    View Full Code Here
       1: import java.awt.Component;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:     private void call(String s, MouseEvent mouseevent) {
       7:         int ai[] = {
       8:         ...
       9:         mouseevent.isPopupTrigger() ? 1 : 0, 
      10:         mouseevent.getClickCount(), 
      11:         mouseevent.getX(), 

    View Full Code Here
       1: import java.awt.*;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:   public static MouseEvent convert(MouseEvent event, Component newSource) {
       7:     return convert(event,
       8:         ...
       9:                           p.y,
      10:                           event.getClickCount(),
      11:                           event.isPopupTrigger(),

    View Full Code Here
       1: import java.awt.Component;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:     private void call(String s, MouseEvent mouseevent) {
       7:         int ai[] = {
       8:         ...
       9:         mouseevent.isPopupTrigger() ? 1 : 0, 
      10:         mouseevent.getClickCount(), 
      11:         mouseevent.getX(), 

    View Full Code Here

    getMouseModifiersText

    public static String getMouseModifiersText(int modifiers)
    Returns a String describing the modifier keys and mouse buttons that were down during the event, such as "Shift", or "Ctrl+Shift". These strings can be localized by changing the awt.properties file.

    Note that InputEvent.ALT_MASK and InputEvent.BUTTON2_MASK have the same value, so the string "Alt" is returned for both modifiers. Likewise, InputEvent.META_MASK and InputEvent.BUTTON3_MASK have the same value, so the string "Meta" is returned for both modifiers.

    Parameters:
    modifiers - a modifier mask describing the modifier keys and mouse buttons that were down during the event
    Returns:
    string a text description of the combination of modifier keys and mouse buttons that were down during the event
    Since:
    1.4
    Usages and Demos :

    View More Examples of getMouseModifiersText(int modifiers)
       1: import java.awt.Window;
       2: import java.awt.event.MouseEvent;
       3: import java.lang.ref.WeakReference;
       4:         ...
       5:         if ((awtEvent.getID() & AWTEvent.MOUSE_EVENT_MASK) != 0) {
       6:             MouseEvent e = (MouseEvent)awtEvent;
       7:             switch (e.getID()) {
       8:         ...
       9:         if (includeModifiers && (modifiers != 0))
      10:             result.insert(0, "  " + MouseEvent.getMouseModifiersText(modifiers));
      11:         

    View Full Code Here

    getPoint

    public Point getPoint()
    Returns the x,y position of the event relative to the source component.
    Returns:
    a Point object containing the x and y coordinates relative to the source component
    Usages and Demos :

    View More Examples of getPoint()
       1: import java.awt.*;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: public class TabDragEvent extends TabEvent {
       6:   private MouseEvent mouseEvent;
       7: 
       8:         ...
       9:   public Point getPoint() {
      10:     return mouseEvent.getPoint();
      11:   }

    View Full Code Here
       1: import java.awt.Cursor;
       2: import java.awt.event.MouseEvent;
       3: import java.awt.geom.Point2D;
       4:         ...
       5:     
       6:     public void itemEntered(VisualItem item, MouseEvent e) {
       7:         if ( !(item instanceof NodeItem) ) return;
       8:         ...
       9:     
      10:     public void itemExited(VisualItem item, MouseEvent e) {
      11:         if ( !(item instanceof NodeItem) ) return;
      12:         ...
      13:         Display d = (Display)e.getComponent();
      14:         down = d.getAbsoluteCoordinate(e.getPoint(), down);

    View Full Code Here
       1: 
       2:     public void mouseMoved(MouseEvent e) {
       3:         redispatchMouseEvent(e, false);
       4:         ...
       5:     }
       6:     public void mouseDragged(MouseEvent e) {
       7:         redispatchMouseEvent(e, false);
       8:         ...
       9:     }
      10:     public void mouseClicked(MouseEvent e) {
      11:         redispatchMouseEvent(e, false);
      12:         ...
      13:     
      14:         Component component = getRealComponent(e.getPoint());

    View Full Code Here
       1: 
       2:     public void mouseClicked(MouseEvent e)  {
       3:     }
       4:         ...
       5:     public void mouseExited(MouseEvent e)  {
       6:     }
       7:         ...
       8:     public void mouseReleased(MouseEvent e)  {
       9:         inDrag = false;
      10:         ...
      11:     public void mouseDragged(MouseEvent e) {
      12:         Point p = e.getPoint();

    View Full Code Here
       1: import java.awt.Window;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5:     
       6:     public static MouseResizeHotSpot getHotSpot(Window w, MouseEvent e) {
       7:         return getHotSpot(w, getPoint(w, e));
       8:         ...
       9:     
      10:     public final boolean isActive(Window w, MouseEvent e) {
      11:         Point p = getPoint(w, e);
      12:         ...
      13:         SwingUtilities.convertMouseEvent(source, e, w);
      14:         return e.getPoint();

    View Full Code Here

    getX

    public int getX()
    Returns the horizontal x position of the event relative to the source component.
    Returns:
    x an integer indicating horizontal position relative to the component
    Usages and Demos :

    View More Examples of getX()
       1: public class ClickListener extends MouseAdapter {
       2:   public void mousePressed(MouseEvent event) {
       3:     System.out.println("Mouse pressed at (" +
       4:         ...
       5:                        event.getX() + "," +
       6:                        event.getY() + ").");
       7:   }
       8: }

    View Full Code Here
       1:   }
       2:   protected void processMouseEvent(MouseEvent e){
       3:     if (e.isPopupTrigger())
       4:         ...
       5:       popup.show(
       6:         e.getComponent(), e.getX(), e.getY());
       7:     else super.processMouseEvent(e);
       8:   }
       9:   public static void main(String args[]) {

    View Full Code Here
       1: 
       2:   public void processMouseEvent(MouseEvent event) {
       3:     System.out.println("Mouse enter/exit or click at (" +
       4:         ...
       5:                        event.getX() + "," +
       6:                        event.getY() + ").");
       7:         ...
       8:   
       9:   public void processMouseMotionEvent(MouseEvent event) {
      10:     System.out.println("Mouse move/drag at (" +
      11:         ...
      12:                        event.getX() + "," +

    View Full Code Here
       1: import java.awt.Component;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:     private void call(String s, MouseEvent mouseevent) {
       7:         int ai[] = {
       8:         ...
       9:         mouseevent.getClickCount(), 
      10:         mouseevent.getX(), 
      11:         mouseevent.getY()

    View Full Code Here
       1:   class PopupListener extends MouseAdapter {
       2:     public void mousePressed(MouseEvent e) {
       3:       maybeShowPopup(e);
       4:         ...
       5:     }
       6:     public void mouseReleased(MouseEvent e) {
       7:       maybeShowPopup(e);
       8:         ...
       9:     }
      10:     private void maybeShowPopup(MouseEvent e) {
      11:       if(e.isPopupTrigger()) {
      12:         ...
      13:         mistniNabidka.show(
      14:           e.getComponent(), e.getX(), e.getY());

    View Full Code Here

    getY

    public int getY()
    Returns the vertical y position of the event relative to the source component.
    Returns:
    y an integer indicating vertical position relative to the component
    Usages and Demos :

    View More Examples of getY()
       1:   }
       2:   protected void processMouseEvent(MouseEvent e){
       3:     if (e.isPopupTrigger())
       4:         ...
       5:       popup.show(
       6:         e.getComponent(), e.getX(), e.getY());
       7:     else super.processMouseEvent(e);
       8:   }
       9:   public static void main(String args[]) {

    View Full Code Here
       1: 
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:         public void mousePressed(MouseEvent e) { 
       7: 
       8:         ...
       9: 
      10:             lastY = e.getY();
      11: 
      12:         ...
      13: 
      14:         public void mouseDragged(MouseEvent e) {

    View Full Code Here
       1:   class PopupListener extends MouseAdapter {
       2:     public void mousePressed(MouseEvent e) {
       3:       maybeShowPopup(e);
       4:         ...
       5:     }
       6:     public void mouseReleased(MouseEvent e) {
       7:       maybeShowPopup(e);
       8:         ...
       9:     }
      10:     private void maybeShowPopup(MouseEvent e) {
      11:       if(e.isPopupTrigger()) {
      12:         ...
      13:         mistniNabidka.show(
      14:           e.getComponent(), e.getX(), e.getY());

    View Full Code Here
       1: import java.awt.event.MouseMotionListener;
       2: import java.awt.event.MouseEvent;
       3: import javax.swing.JFrame;
       4:         ...
       5:          {  
       6:             public void mouseDragged( MouseEvent event )
       7:             {
       8:         ...
       9: 
      10:             public void mouseMoved( MouseEvent event )
      11:             {

    View Full Code Here
       1:               {
       2:                 public void mousePressed(MouseEvent e)
       3:                 {
       4:         ...
       5:                     startDrag = new Point(e.getX(), e.getY());
       6:                   endDrag = startDrag;
       7:         ...
       8: 
       9:                 public void mouseReleased(MouseEvent e)
      10:                 {
      11:         ...
      12:                                  startDrag.x, startDrag.y,
      13:                                 e.getX(), e.getY());

    View Full Code Here

    isPopupTrigger

    public boolean isPopupTrigger()
    Returns whether or not this mouse event is the popup menu trigger event for the platform.

    Note: Popup menus are triggered differently on different systems. Therefore, isPopupTrigger should be checked in both mousePressed and mouseReleased for proper cross-platform functionality.

    Returns:
    boolean, true if this event is the popup menu trigger for this platform
    Usages and Demos :

    View More Examples of isPopupTrigger()
       1: 
       2:     MouseEvent translateMouseEv(MouseEvent e) {
       3:     int i=locationToIndex(new Point(e.getX(),e.getY()));
       4:         ...
       5:     Rectangle r=getCellBounds(i,i);
       6:     MouseEvent e2=new MouseEvent((Component) e.getSource(),
       7:                      e.getID(),
       8:         ...
       9:                      e.getClickCount(),
      10:                      e.isPopupTrigger());
      11:     return(e2);

    View Full Code Here
       1: import java.awt.*;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:   public static MouseEvent convert(MouseEvent event, Component newSource) {
       7:     return convert(event,
       8:         ...
       9:                           event.getClickCount(),
      10:                           event.isPopupTrigger(),
      11:                           event.getButton());

    View Full Code Here
       1: 
       2: import java.awt.event.MouseEvent;
       3: import java.awt.Component;
       4:         ...
       5: 
       6: public class WorldMouseEvent extends MouseEvent {
       7: 
       8:         ...
       9: 
      10:   public WorldMouseEvent(MouseEvent event, double worldx, double worldy) {
      11:     super((Component) event.getSource(), event.getID(), event.getWhen(), 
      12:         ...
      13:       event.getModifiers(), event.getX(), event.getY(), 
      14:       event.getClickCount(), event.isPopupTrigger());

    View Full Code Here
       1:                     try {
       2:                         if(evt instanceof MouseEvent) {
       3:         ...
       4:                             MouseEvent me = (MouseEvent)evt;
       5:                             out.writeObject(me.getComponent().getName());
       6:         ...
       7:                     me.getClickCount(),
       8:                     me.isPopupTrigger(),
       9:                     me.getButton()

    View Full Code Here
       1: 
       2:     private void createMouseEvent(MouseEvent e)
       3:     {
       4:         ...
       5:             switch(id) {
       6:                 case MouseEvent.MOUSE_PRESSED:
       7:         ...
       8:                 case MouseEvent.MOUSE_RELEASED:
       9:                 case MouseEvent.MOUSE_CLICKED:
      10:         ...
      11:                         e.getX(), e.getY(), e.getClickCount(),
      12:                         e.isPopupTrigger()

    View Full Code Here

    paramString

    public String paramString()
    Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
    Overrides:
    paramString in interface ComponentEvent
    Returns:
    a string identifying the event and its attributes
    Usages and Demos :

    View More Examples of paramString()
       1: {    static int ID=0;
       2:     MouseEvent E;
       3:     
       4:         ...
       5:     public ListerMouseEvent (Object o, String name, MouseEvent e)
       6:     {    super(o,ID++,name);
       7:         ...
       8:     
       9:     public MouseEvent getEvent ()
      10:     {    return E;
      11:         ...
      12:     public String getName ()
      13:     {    return E.paramString();

    View Full Code Here
       1: import java.awt.Component;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:     private void call(String s, MouseEvent mouseevent) {
       7:         int ai[] = {
       8:         ...
       9:         };
      10:         JHandler.callLisp(s, mouseevent.getComponent(), mouseevent.paramString(), ai);
      11:     }

    View Full Code Here
       1: import java.awt.Component;
       2: import java.awt.event.MouseEvent;
       3: 
       4:         ...
       5: 
       6:     private void call(String s, MouseEvent mouseevent) {
       7:         int ai[] = {
       8:         ...
       9:         };
      10:         JHandler.callLisp(s, mouseevent.getComponent(), mouseevent.paramString(), ai);
      11:     }

    View Full Code Here
       1:     {
       2:         log.config(e.paramString());
       3:         if (e.getSource() instanceof VMemo)
       4:         ...
       5: 
       6:     public void mouseClicked(MouseEvent e)
       7:     {
       8:         if (SwingUtilities.isRightMouseButton(e))
       9:             adaptee.popupMenu.show((Component)e.getSource(), e.getX(), e.getY());

    View Full Code Here

    translatePoint

    public void translatePoint(int x,
                               int y)
    Translates the event's coordinates to a new position by adding specified x (horizontal) and y (vertical) offsets.
    Parameters:
    x - the horizontal x value to add to the current x coordinate position
    y - the vertical y value to add to the current y coordinate position
    Usages and Demos :

    View More Examples of translatePoint(int x,int y)
       1:     SequenceRenderContext src,
       2:     MouseEvent me,
       3:     List path
       4:         ...
       5:     if(src.getDirection() == SequenceRenderContext.HORIZONTAL) {
       6:       me.translatePoint(0, -padding);
       7:     } else {
       8:         ...
       9:       me.translatePoint(-padding, 0);
      10:     }
      11:         ...
      12:     if(src.getDirection() == SequenceRenderContext.HORIZONTAL) {
      13:       me.translatePoint(0, padding);

    View Full Code Here
       1: import java.awt.event.MouseAdapter;
       2: import java.awt.event.MouseEvent;
       3: import java.util.Iterator;
       4:         ...
       5:       {
       6:          public void mousePressed(MouseEvent evt)
       7:          {
       8:         ...
       9:          }
      10:          public void mouseReleased(MouseEvent evt)
      11:          {
      12:         ...
      13:       Point origin = indexToLocation(index);
      14:       evt.translatePoint(-origin.x,  -origin.y);

    View Full Code Here
       1: 
       2:     public SequenceViewerEvent processMouseEvent(List srcL, MouseEvent me,
       3:                                                  List path, List renderers) {
       4:         ...
       5:                 if ((me.getY() >= offset) && (me.getY() < offset + depth)) {
       6:                     me.translatePoint(0, (int) -offset);
       7:                     sve = sRend.processMouseEvent(src, me, path);
       8:         ...
       9:                     me.translatePoint(0, (int) +offset);
      10:                 }

    View Full Code Here
       1: 
       2:       public void mousePressed(MouseEvent e) {
       3: 
       4:         ...
       5:          e.translatePoint(-offX, -offY);
       6: 
       7:         ...
       8:       }
       9:       public void mouseReleased(MouseEvent e) {
      10:         ...
      11:          e.translatePoint(-offX, -offY);

    View Full Code Here
       1:   private MouseListener mouseListener = new MouseAdapter() {
       2:     public void mouseClicked(MouseEvent me) {
       3:       if(!isActive()) {
       4:         ...
       5:       int [] dist = calcDist();
       6:       me.translatePoint(+dist[0], +dist[1]);
       7:       SequenceViewerEvent sve = renderer.processMouseEvent(
       8:         ...
       9:       );
      10:       me.translatePoint(-dist[0], -dist[1]);
      11:       svSupport.fireMouseClicked(sve);
      12:         ...
      13: 
      14:     public void mousePressed(MouseEvent me) {

    View Full Code Here