public class MouseEvent extends MouseEvent
MouseEvent
will be invoked if a mouse button has been pressed.
This event should not be confused with java.awt.event.MouseEvent. You should explicitly use com.webrenderer.event.MouseEvent
This MouseEvent inherits from the java.awt.event.MouseEvent.
When using this object you can find the button pressed by using the
getModifiers()
method.
e.g.
public void onClick( com.webrenderer.event.MouseEvent e ) {
if ( (e.getModifiers() & 4) > 0 )
System.out.println("Right Button Pressed");
else
System.out.println("Left Button Pressed");
}
}
To reduce the cost of multiple method invocations, the event object will record the new data pertaining to the event.
BUTTON1, BUTTON2, BUTTON3, MOUSE_CLICKED, MOUSE_DRAGGED, MOUSE_ENTERED, MOUSE_EXITED, MOUSE_FIRST, MOUSE_LAST, MOUSE_MOVED, MOUSE_PRESSED, MOUSE_RELEASED, MOUSE_WHEEL, NOBUTTON
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
COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, 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
source
Constructor and Description |
---|
MouseEvent(Component source,
int id,
int modifiers,
int x,
int y,
int clickCount)
Creates a com.webrenderer.event.MouseEvent with the specified parameters.
|
MouseEvent(Component source,
int id,
int modifiers,
int x,
int y,
int clickCount,
boolean popupTrigger) |
Modifier and Type | Method and Description |
---|---|
IElement |
getTargetElement()
Returns the DOM element that this mouse event was fired on.
|
void |
setTargetElement(IElement targetElement) |
getButton, getClickCount, getLocationOnScreen, getModifiersEx, getMouseModifiersText, getPoint, getX, getXOnScreen, getY, getYOnScreen, isPopupTrigger, paramString, translatePoint
consume, getMaskForButton, getModifiers, getModifiersExText, getWhen, isAltDown, isAltGraphDown, isConsumed, isControlDown, isMetaDown, isShiftDown
getComponent
getSource
public MouseEvent(Component source, int id, int modifiers, int x, int y, int clickCount)
When using this object you can find the button pressed by using the
getModifiers()
method.
e.g.
public void onClick(MouseEvent e) {
if ( (e.getModifiers() & 4) >0 )
System.out.println("Right Button Pressed");
else
System.out.println("Left Button Pressed");
}
}
public MouseEvent(Component source, int id, int modifiers, int x, int y, int clickCount, boolean popupTrigger)