public class ContextMenuEvent extends InputEvent
The event coordinates contain default position for the context menu. For mouse-triggered events it is the position of the mouse cursor, for keyboard-triggered events it is a point inside of bounds of current focus owner (which is the event's target).
Modifier and Type | Field and Description |
---|---|
static EventType<ContextMenuEvent> |
ANY
Common supertype for all context menu event types.
|
static EventType<ContextMenuEvent> |
CONTEXT_MENU_REQUESTED
This event occurs when a context menu is requested.
|
consumed, eventType, NULL_SOURCE_TARGET, target
source
Constructor and Description |
---|
ContextMenuEvent(EventType<ContextMenuEvent> eventType,
double x,
double y,
double screenX,
double screenY,
boolean keyboardTrigger,
PickResult pickResult)
Constructs new ContextMenu event with empty source and target.
|
ContextMenuEvent(Object source,
EventTarget target,
EventType<ContextMenuEvent> eventType,
double x,
double y,
double screenX,
double screenY,
boolean keyboardTrigger,
PickResult pickResult)
Constructs new ContextMenu event.
|
Modifier and Type | Method and Description |
---|---|
ContextMenuEvent |
copyFor(Object newSource,
EventTarget newTarget)
Creates and returns a copy of this event with the specified event source
and target.
|
EventType<ContextMenuEvent> |
getEventType()
Gets the event type of this event.
|
PickResult |
getPickResult()
Returns information about the pick.
|
double |
getSceneX()
Returns horizontal position of the event relative to the
origin of the
Scene that contains the ContextMenuEvent's source. |
double |
getSceneY()
Returns vertical position of the event relative to the
origin of the
Scene that contains the ContextMenuEvent's source. |
double |
getScreenX()
Returns absolute horizontal position of the event.
|
double |
getScreenY()
Returns absolute vertical position of the event.
|
double |
getX()
Horizontal position of the event relative to the
origin of the ContextMenuEvent's source.
|
double |
getY()
Vertical position of the event relative to the
origin of the ContextMenuEvent's source.
|
double |
getZ()
Depth position of the event relative to the
origin of the MouseEvent's source.
|
boolean |
isKeyboardTrigger()
Determines whether this event originated from the keyboard.
|
String |
toString()
Returns a string representation of this
ContextMenuEvent object. |
getSource
public static final EventType<ContextMenuEvent> CONTEXT_MENU_REQUESTED
public static final EventType<ContextMenuEvent> ANY
public ContextMenuEvent(Object source, EventTarget target, EventType<ContextMenuEvent> eventType, double x, double y, double screenX, double screenY, boolean keyboardTrigger, PickResult pickResult)
source
- the source of the event. Can be null.target
- the target of the event. Can be null.eventType
- The type of the event.x
- The x with respect to the sceney
- The y with respect to the scenescreenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.keyboardTrigger
- true if this event was triggered by keyboard.pickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinates and the targetpublic ContextMenuEvent(EventType<ContextMenuEvent> eventType, double x, double y, double screenX, double screenY, boolean keyboardTrigger, PickResult pickResult)
eventType
- The type of the event.x
- The x with respect to the scene.y
- The y with respect to the scene.screenX
- The x coordinate relative to screen.screenY
- The y coordinate relative to screen.keyboardTrigger
- true if this event was triggered by keyboard.pickResult
- pick result. Can be null, in this case a 2D pick result
without any further values is constructed
based on the scene coordinatespublic ContextMenuEvent copyFor(Object newSource, EventTarget newTarget)
Event
null
, it is
replaced by the NULL_SOURCE_TARGET
value.public EventType<ContextMenuEvent> getEventType()
Event
Event
class can have different event types. These event types further specify
what kind of event occurred.getEventType
in class InputEvent
public boolean isKeyboardTrigger()
public final double getX()
ContextMenuEvent
.public final double getY()
ContextMenuEvent
.public final double getZ()
public final double getScreenX()
ContextMenuEvent
.public final double getScreenY()
ContextMenuEvent
.public final double getSceneX()
Scene
that contains the ContextMenuEvent's source.
If the node is not in a Scene
, then the value is relative to
the boundsInParent of the root-most parent of the ContextMenuEvent's node.
For more information about this event's coordinate semantics please see
the general description of ContextMenuEvent
.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the ContextMenuEvent's sourcepublic final double getSceneY()
Scene
that contains the ContextMenuEvent's source.
If the node is not in a Scene
, then the value is relative to
the boundsInParent of the root-most parent of the ContextMenuEvent's node.
For more information about this event's coordinate semantics please see
the general description of ContextMenuEvent
.
Note that in 3D scene, this represents the flat coordinates after
applying the projection transformations.Scene
that contains the ContextMenuEvent's sourcepublic final PickResult getPickResult()
public String toString()
ContextMenuEvent
object.toString
in class EventObject
ContextMenuEvent
object.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.