Class UIMouseEvent
public class UIMouseEvent extends UIInputEvent
{
// Fields
public static final int MOUSE_CLICKED;
public static final int MOUSE_DRAGGED;
public static final int MOUSE_ENTERED;
public static final int MOUSE_EVENT_BASE;
public static final int MOUSE_EXITED;
public static final int MOUSE_MOVED;
public static final int MOUSE_PRESSED;
public static final int MOUSE_RELEASED;
// Constructors
public UIMouseEvent(IUIComponent source, int id, long when,
int modifiers, int x, int y, int clickCount,
boolean popupTrigger);
// Methods
public int getClickCount();
public synchronized Point getPoint();
public int getX();
public int getY();
public boolean isPopupTrigger();
public String paramString();
}
This class generates mouse events. These events are received in two different listeners, UIMouseMotionListener and UIMouseListener.
EventObject
|
+--UIBaseEvent
|
+--UIEvent
|
+--UIInputEvent
|
+--UIMouseEvent
public UIMouseEvent(IUIComponent source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger);
Creates a UIMouseEvent object with the specified source IUIComponent , type, modifiers, coordinates, and click count.
Parameter | Description |
source
| The object where the event originated.
|
id
| The event type.
|
when
| The time that the event occurred.
|
modifiers
| The modifiers down during event.
|
x
| The x coordinate location of the mouse.
|
y
| The y coordinate location of the mouse.
|
clickCount
| The number of mouse clicks associated with the event.
|
popupTrigger
| Set to true if this event is a pop-up menu trigger event.
|
public int getClickCount();
Retrieves the number of mouse button clicks associated with this event.
Return Value:
Returns the number of button clicks associated with the event.
public synchronized Point getPoint();
Retrieves the (x,y) position of the event relative to the source component.
Return Value:
Returns the Point that describes the location of the event.
public int getX();
Retrieves the x coordinate of the event relative to the source component.
Return Value:
Returns the x coordinate of the event.
public int getY();
Retrieves the y coordinate of the event relative to the source component.
Return Value:
Returns the y coordinate of the event.
public boolean isPopupTrigger();
Determines whether or not the mouse event is the pop-up menu trigger event for the platform.
Return Value:
Returns true if the event is the pop-up menu trigger event for the current platform.
public String paramString();
This method is used internally by the toString method.
Return Value:
Returns a formatted String object that assists with textual representation of the exception.
- MOUSE_CLICKED
- The mouse clicked event type.
- MOUSE_DRAGGED
- The mouse dragged event type.
- MOUSE_ENTERED
- The mouse entered event type.
- MOUSE_EVENT_BASE
- The base identifier for all UIMouseEvent events.
- MOUSE_EXITED
- The mouse exited event type.
- MOUSE_MOVED
- The mouse moved event type.
- MOUSE_PRESSED
- The mouse pressed event type.
- MOUSE_RELEASED
- The mouse released event type.