Spec-Zone .ru
спецификации, руководства, описания, API
|
public abstract class Node extends java.lang.Object implements EventTarget
Each item in the scene graph is called a Node
. Branch nodes are
of type Parent
, whose concrete subclasses are Group
,
Region
, and Control
,
or subclasses thereof.
Leaf nodes are classes such as
Rectangle
, Text
,
ImageView
, MediaView
,
or other such leaf classes which cannot have children. Only a single node within
each scene graph tree will have no parent, which is referred to as the "root" node.
There may be several trees in the scene graph. Some trees may be part of
a Scene
, in which case they are eligible to be displayed.
Other trees might not be part of any Scene
.
A node may occur at most once anywhere in the scene graph. Specifically,
a node must appear no more than once in all of the following:
as the root node of a Scene
,
the children ObservableList of a Parent
,
or as the clip of a Node
.
The scene graph must not have cycles. A cycle would exist if a node is
an ancestor of itself in the tree, considering the Group
content
ObservableList, Parent
children ObservableList, and Node
clip relationships
mentioned above.
If a program adds a child node to a Parent (including Group, Region, etc) and that node is already a child of a different Parent or the root of a Scene, the node is automatically (and silently) removed from its former parent. If a program attempts to modify the scene graph in any other way that violates the above rules, an exception is thrown, the modification attempt is ignored and the scene graph is restored to its previous state.
It is possible to rearrange the structure of the scene graph, for example, to move a subtree from one location in the scene graph to another. In order to do this, one would normally remove the subtree from its old location before inserting it at the new location. However, the subtree will be automatically removed as described above if the application doesn't explicitly remove it.
Node objects may be constructed and modified on any thread as long they are
not yet attached to a Scene
. An application must attach nodes to a
Scene, and modify nodes that are already attached to a Scene, on the JavaFX
Application Thread.
Each node in the scene graph can be given a unique id
. This id is
much like the "id" attribute of an HTML tag in that it is up to the designer
and developer to ensure that the id
is unique within the scene graph.
A convenience function called lookup(String)
can be used to find
a node with a unique id within the scene graph, or within a subtree of the
scene graph. The id can also be used identify nodes for applying styles; see
the CSS section below.
The Node
class defines a traditional computer graphics "local"
coordinate system in which the x
axis increases to the right and the
y
axis increases downwards. The concrete node classes for shapes
provide variables for defining the geometry and location of the shape
within this local coordinate space. For example,
Rectangle
provides x
, y
,
width
, height
variables while
Circle
provides centerX
, centerY
,
and radius
.
At the device pixel level, integer coordinates map onto the corners and
cracks between the pixels and the centers of the pixels appear at the
midpoints between integer pixel locations. Because all coordinate values
are specified with floating point numbers, coordinates can precisely
point to these corners (when the floating point values have exact integer
values) or to any location on the pixel. For example, a coordinate of
(0.5, 0.5)
would point to the center of the upper left pixel on the
Stage
. Similarly, a rectangle at (0, 0)
with dimensions
of 10
by 10
would span from the upper left corner of the
upper left pixel on the Stage
to the lower right corner of the
10th pixel on the 10th scanline. The pixel center of the last pixel
inside that rectangle would be at the coordinates (9.5, 9.5)
.
In practice, most nodes have transformations applied to their coordinate
system as mentioned below. As a result, the information above describing
the alignment of device coordinates to the pixel grid is relative to
the transformed coordinates, not the local coordinates of the nodes.
The Shape
class describes some additional
important context-specific information about coordinate mapping and how
it can affect rendering.
Any Node
can have transformations applied to it. These include
translation, rotation, scaling, or shearing.
A translation transformation is one which shifts the origin of the
node's coordinate space along either the x or y axis. For example, if you
create a Rectangle
which is drawn at the origin
(x=0, y=0) and has a width of 100 and a height of 50, and then apply a
Translate
with a shift of 10 along the x axis
(x=10), then the rectangle will appear drawn at (x=10, y=0) and remain
100 points wide and 50 tall. Note that the origin was shifted, not the
x
variable of the rectangle.
A common node transform is a translation by an integer distance, most often used to lay out nodes on the stage. Such integer translations maintain the device pixel mapping so that local coordinates that are integers still map to the cracks between pixels.
A rotation transformation is one which rotates the coordinate space of
the node about a specified "pivot" point, causing the node to appear rotated.
For example, if you create a Rectangle
which is
drawn at the origin (x=0, y=0) and has a width of 100 and height of 30 and
you apply a Rotate
with a 90 degree rotation
(angle=90) and a pivot at the origin (pivotX=0, pivotY=0), then
the rectangle will be drawn as if its x and y were zero but its height was
100 and its width -30. That is, it is as if a pin is being stuck at the top
left corner and the rectangle is rotating 90 degrees clockwise around that
pin. If the pivot point is instead placed in the center of the rectangle
(at point x=50, y=15) then the rectangle will instead appear to rotate about
its center.
Note that as with all transformations, the x, y, width, and height variables of the rectangle (which remain relative to the local coordinate space) have not changed, but rather the transformation alters the entire coordinate space of the rectangle.
A scaling transformation causes a node to either appear larger or
smaller depending on the scaling factor. Scaling alters the coordinate space
of the node such that each unit of distance along the axis in local
coordinates is multipled by the scale factor. As with rotation
transformations, scaling transformations are applied about a "pivot" point.
You can think of this as the point in the Node around which you "zoom". For
example, if you create a Rectangle
with a
strokeWidth
of 5, and a width and height of 50, and you apply a
Scale
with scale factors (x=2.0, y=2.0) and
a pivot at the origin (pivotX=0, pivotY=0), the entire rectangle
(including the stroke) will double in size, growing to the right and
downwards from the origin.
A shearing transformation, sometimes called a skew, effectively rotates one axis so that the x and y axes are no longer perpendicular.
Multiple transformations may be applied to a node by specifying an ordered
chain of transforms. The order in which the transforms are applied is
defined by the ObservableList specified in the transforms
variable.
Since every Node
has transformations, every Node's geometric
bounding rectangle can be described differently depending on whether
transformations are accounted for or not.
Each Node
has a read-only boundsInLocal
variable which specifies the bounding rectangle of the Node
in
untransformed local coordinates. boundsInLocal
includes the
Node's shape geometry, including any space required for a
non-zero stroke that may fall outside the local position/size variables,
and its clip
and effect
variables.
Each Node
also has a read-only boundsInParent
variable which
specifies the bounding rectangle of the Node
after all transformations
have been applied, including those set in transforms
,
scaleX
/scaleY
, rotate
,
translateX
/translateY
, and layoutX
/layoutY
.
It is called "boundsInParent" because the rectangle will be relative to the
parent's coordinate system. This is the 'visual' bounds of the node.
Finally, the layoutBounds
variable defines the rectangular bounds of
the Node
that should be used as the basis for layout calculations and
may differ from the visual bounds of the node. For shapes, Text, and ImageView,
layoutBounds by default includes only the shape geometry, including space required
for a non-zero strokeWidth
, but does not include the effect,
clip, or any transforms. For resizable classes (Regions and Controls)
layoutBounds will always map to 0,0 width x height
.
The Node
class contains id
, styleClass
, and
style
variables that are used in styling this node from
CSS. The id
and styleClass
variables are used in
CSS style sheets to identify nodes to which styles should be
applied. The style
variable contains style properties and
values that are applied directly to this node.
For further information about CSS and how to apply CSS styles to nodes, see the CSS Reference Guide.
Type | Property and Description |
---|---|
ObjectProperty<BlendMode> |
blendMode
The
BlendMode used to blend this individual node
into the scene behind it. |
ReadOnlyObjectProperty<Bounds> |
boundsInLocal
The rectangular bounds of this
Node in the node's
untransformed local coordinate space. |
ReadOnlyObjectProperty<Bounds> |
boundsInParent
The rectangular bounds of this
Node which include its transforms. |
ObjectProperty<CacheHint> |
cacheHint
Additional hint for controlling bitmap caching.
|
BooleanProperty |
cache
A performance hint to the system to indicate that this
Node
should be cached as a bitmap. |
ObjectProperty<Node> |
clip
Specifies a
Node to use to define the the clipping shape for this
Node. |
ObjectProperty<Cursor> |
cursor
Defines the mouse cursor for this
Node and subnodes. |
ObjectProperty<DepthTest> |
depthTest
Indicates whether depth testing is used when rendering this node.
|
ReadOnlyBooleanProperty |
disabled
Indicates whether or not this
Node is disabled. |
BooleanProperty |
disable
Sets the individual disabled state of this
Node . |
ObjectProperty<Effect> |
effect
Specifies an effect to apply to this
Node . |
ObjectProperty<EventDispatcher> |
eventDispatcher
Specifies the event dispatcher for this node.
|
ReadOnlyBooleanProperty |
focused
Indicates whether this
Node currently has the input focus. |
BooleanProperty |
focusTraversable
Specifies whether this
Node should be a part of focus traversal
cycle. |
ReadOnlyBooleanProperty |
hover
Whether or not this
Node is being hovered over. |
StringProperty |
id
The id of this
Node . |
ObjectProperty<InputMethodRequests> |
inputMethodRequests
Property holding InputMethodRequests.
|
ReadOnlyObjectProperty<Bounds> |
layoutBounds
The rectangular bounds that should be used for layout calculations for
this node.
|
DoubleProperty |
layoutX
Defines the x coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
DoubleProperty |
layoutY
Defines the y coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
BooleanProperty |
managed
Defines whether or not this node's layout will be managed by it's parent.
|
BooleanProperty |
mouseTransparent
If
true , this node (together with all its children) is completely
transparent to mouse events. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onDragDetected
Defines a function to be called when drag gesture has been
detected.
|
ObjectProperty<EventHandler<? super DragEvent>> |
onDragDone
Defines a function to be called when this
Node is a
drag and drop gesture source after its data has
been dropped on a drop target. |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragDropped
Defines a function to be called when the mouse button is released
on this
Node during drag and drop gesture. |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragEntered
Defines a function to be called when drag gesture
enters this
Node . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragExited
Defines a function to be called when drag gesture
exits this
Node . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragOver
Defines a function to be called when drag gesture progresses within
this
Node . |
ObjectProperty<EventHandler<? super InputMethodEvent>> |
onInputMethodTextChanged
Defines a function to be called when this
Node
has input focus and the input method text has changed. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyPressed
Defines a function to be called when this
Node or its child
Node has input focus and a key has been pressed. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyReleased
Defines a function to be called when this
Node or its child
Node has input focus and a key has been released. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyTyped
Defines a function to be called when this
Node or its child
Node has input focus and a key has been typed. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseClicked
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseDragged
Defines a function to be called when a mouse button is pressed
on this
Node and then dragged. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseEntered
Defines a function to be called when the mouse enters this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseExited
Defines a function to be called when the mouse exits this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseMoved
Defines a function to be called when mouse cursor moves within
this
Node but no buttons have been pushed. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMousePressed
Defines a function to be called when a mouse button
has been pressed on this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseReleased
Defines a function to be called when a mouse button
has been released on this
Node . |
ObjectProperty<EventHandler<? super ScrollEvent>> |
onScroll
Defines a function to be called when user performs a scrolling action.
|
DoubleProperty |
opacity
Specifies how opaque (that is, solid) the
Node appears. |
ReadOnlyObjectProperty<Parent> |
parent
The parent of this
Node . |
BooleanProperty |
pickOnBounds
Defines how the picking computation is done for this node when
triggered by a
MouseEvent or a contains function call. |
ReadOnlyBooleanProperty |
pressed
Whether or not the
Node is pressed. |
DoubleProperty |
rotate
Defines the angle of rotation about the
Node 's center, measured in
degrees. |
ObjectProperty<Point3D> |
rotationAxis
Defines the axis of rotation of this
Node . |
DoubleProperty |
scaleX
Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this
Node . |
DoubleProperty |
scaleY
Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this
Node . |
DoubleProperty |
scaleZ
Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this
Node . |
ReadOnlyObjectProperty<Scene> |
scene
The
Scene that this Node is part of. |
StringProperty |
style
A string representation of the CSS style associated with this
specific
Node . |
DoubleProperty |
translateX
Defines the x coordinate of the translation that is added to this
Node 's
transform. |
DoubleProperty |
translateY
Defines the y coordinate of the translation that is added to this
Node 's
transform. |
DoubleProperty |
translateZ
Defines the Z coordinate of the translation that is added to the
transformed coordinates of this
Node . |
BooleanProperty |
visible
Specifies whether this
Node and any subnodes should be rendered
as part of the scene graph. |
Modifier | Constructor and Description |
---|---|
protected |
Node()
Creates a new instance of Node.
|
Modifier and Type | Method and Description |
---|---|
<T extends Event> |
addEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Registers an event filter to this node.
|
<T extends Event> |
addEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Registers an event handler to this node.
|
void |
autosize()
If the node is resizable, will set its layout bounds to its current preferred
width and height.
|
ObjectProperty<BlendMode> |
blendModeProperty()
The
BlendMode used to blend this individual node
into the scene behind it. |
ReadOnlyObjectProperty<Bounds> |
boundsInLocalProperty()
The rectangular bounds of this
Node in the node's
untransformed local coordinate space. |
ReadOnlyObjectProperty<Bounds> |
boundsInParentProperty()
The rectangular bounds of this
Node which include its transforms. |
EventDispatchChain |
buildEventDispatchChain(EventDispatchChain tail)
Construct an event dispatch chain for this node.
|
ObjectProperty<CacheHint> |
cacheHintProperty()
Additional hint for controlling bitmap caching.
|
BooleanProperty |
cacheProperty()
A performance hint to the system to indicate that this
Node
should be cached as a bitmap. |
ObjectProperty<Node> |
clipProperty()
Specifies a
Node to use to define the the clipping shape for this
Node. |
boolean |
contains(double localX,
double localY)
Returns
true if the given point (specified in the local
coordinate space of this Node ) is contained within the shape of
this Node . |
boolean |
contains(Point2D localPoint)
Returns
true if the given point (specified in the local
coordinate space of this Node ) is contained within the shape of
this Node . |
ObjectProperty<Cursor> |
cursorProperty()
Defines the mouse cursor for this
Node and subnodes. |
ObjectProperty<DepthTest> |
depthTestProperty()
Indicates whether depth testing is used when rendering this node.
|
ReadOnlyBooleanProperty |
disabledProperty()
Indicates whether or not this
Node is disabled. |
BooleanProperty |
disableProperty()
Sets the individual disabled state of this
Node . |
ObjectProperty<Effect> |
effectProperty()
Specifies an effect to apply to this
Node . |
ObjectProperty<EventDispatcher> |
eventDispatcherProperty()
Specifies the event dispatcher for this node.
|
void |
fireEvent(Event event)
Fires the specified event.
|
ReadOnlyBooleanProperty |
focusedProperty()
Indicates whether this
Node currently has the input focus. |
BooleanProperty |
focusTraversableProperty()
Specifies whether this
Node should be a part of focus traversal
cycle. |
double |
getBaselineOffset()
The 'alphabetic' (or 'roman') baseline offset from the node's layoutBounds.minY location
that should be used when this node is being vertically aligned by baseline with
other nodes.
|
BlendMode |
getBlendMode()
The
BlendMode used to blend this individual node
into the scene behind it. |
Bounds |
getBoundsInLocal()
The rectangular bounds of this
Node in the node's
untransformed local coordinate space. |
Bounds |
getBoundsInParent()
The rectangular bounds of this
Node which include its transforms. |
CacheHint |
getCacheHint()
Additional hint for controlling bitmap caching.
|
Node |
getClip()
Specifies a
Node to use to define the the clipping shape for this
Node. |
Orientation |
getContentBias()
Returns the orientation of a node's resizing bias for layout purposes.
|
Cursor |
getCursor()
Defines the mouse cursor for this
Node and subnodes. |
DepthTest |
getDepthTest()
Indicates whether depth testing is used when rendering this node.
|
Effect |
getEffect()
Specifies an effect to apply to this
Node . |
EventDispatcher |
getEventDispatcher()
Specifies the event dispatcher for this node.
|
java.lang.String |
getId()
The id of this
Node . |
InputMethodRequests |
getInputMethodRequests()
Property holding InputMethodRequests.
|
Bounds |
getLayoutBounds()
The rectangular bounds that should be used for layout calculations for
this node.
|
double |
getLayoutX()
Defines the x coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
double |
getLayoutY()
Defines the y coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
EventHandler<? super MouseEvent> |
getOnDragDetected()
Defines a function to be called when drag gesture has been
detected.
|
EventHandler<? super DragEvent> |
getOnDragDone()
Defines a function to be called when this
Node is a
drag and drop gesture source after its data has
been dropped on a drop target. |
EventHandler<? super DragEvent> |
getOnDragDropped()
Defines a function to be called when the mouse button is released
on this
Node during drag and drop gesture. |
EventHandler<? super DragEvent> |
getOnDragEntered()
Defines a function to be called when drag gesture
enters this
Node . |
EventHandler<? super DragEvent> |
getOnDragExited()
Defines a function to be called when drag gesture
exits this
Node . |
EventHandler<? super DragEvent> |
getOnDragOver()
Defines a function to be called when drag gesture progresses within
this
Node . |
EventHandler<? super InputMethodEvent> |
getOnInputMethodTextChanged()
Defines a function to be called when this
Node
has input focus and the input method text has changed. |
EventHandler<? super KeyEvent> |
getOnKeyPressed()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been pressed. |
EventHandler<? super KeyEvent> |
getOnKeyReleased()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been released. |
EventHandler<? super KeyEvent> |
getOnKeyTyped()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been typed. |
EventHandler<? super MouseEvent> |
getOnMouseClicked()
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Node . |
EventHandler<? super MouseEvent> |
getOnMouseDragged()
Defines a function to be called when a mouse button is pressed
on this
Node and then dragged. |
EventHandler<? super MouseEvent> |
getOnMouseEntered()
Defines a function to be called when the mouse enters this
Node . |
EventHandler<? super MouseEvent> |
getOnMouseExited()
Defines a function to be called when the mouse exits this
Node . |
EventHandler<? super MouseEvent> |
getOnMouseMoved()
Defines a function to be called when mouse cursor moves within
this
Node but no buttons have been pushed. |
EventHandler<? super MouseEvent> |
getOnMousePressed()
Defines a function to be called when a mouse button
has been pressed on this
Node . |
EventHandler<? super MouseEvent> |
getOnMouseReleased()
Defines a function to be called when a mouse button
has been released on this
Node . |
EventHandler<? super ScrollEvent> |
getOnScroll()
Defines a function to be called when user performs a scrolling action.
|
double |
getOpacity()
Specifies how opaque (that is, solid) the
Node appears. |
Parent |
getParent()
The parent of this
Node . |
ObservableMap<java.lang.Object,java.lang.Object> |
getProperties()
Returns an observable map of properties on this node for use primarily
by application developers.
|
double |
getRotate()
Defines the angle of rotation about the
Node 's center, measured in
degrees. |
Point3D |
getRotationAxis()
Defines the axis of rotation of this
Node . |
double |
getScaleX()
Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this
Node . |
double |
getScaleY()
Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this
Node . |
double |
getScaleZ()
Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this
Node . |
Scene |
getScene()
The
Scene that this Node is part of. |
java.lang.String |
getStyle()
A string representation of the CSS style associated with this
specific
Node . |
ObservableList<java.lang.String> |
getStyleClass() |
ObservableList<Transform> |
getTransforms()
Defines the ObservableList of
Transform objects
to be applied to this Node . |
double |
getTranslateX()
Defines the x coordinate of the translation that is added to this
Node 's
transform. |
double |
getTranslateY()
Defines the y coordinate of the translation that is added to this
Node 's
transform. |
double |
getTranslateZ()
Defines the Z coordinate of the translation that is added to the
transformed coordinates of this
Node . |
java.lang.Object |
getUserData()
Returns a previously set Object property, or null if no such property
has been set using the
setUserData(java.lang.Object) method. |
boolean |
hasProperties()
Tests if Node has properties.
|
ReadOnlyBooleanProperty |
hoverProperty()
Whether or not this
Node is being hovered over. |
StringProperty |
idProperty()
The id of this
Node . |
ObjectProperty<InputMethodRequests> |
inputMethodRequestsProperty()
Property holding InputMethodRequests.
|
boolean |
intersects(Bounds localBounds)
Returns
true if the given bounds (specified in the local
coordinate space of this Node ) intersects the shape of this
Node . |
boolean |
intersects(double localX,
double localY,
double localWidth,
double localHeight)
Returns
true if the given rectangle (specified in the local
coordinate space of this Node ) intersects the shape of this
Node . |
boolean |
isCache()
A performance hint to the system to indicate that this
Node
should be cached as a bitmap. |
boolean |
isDisable()
Sets the individual disabled state of this
Node . |
boolean |
isDisabled()
Indicates whether or not this
Node is disabled. |
boolean |
isFocused()
Indicates whether this
Node currently has the input focus. |
boolean |
isFocusTraversable()
Specifies whether this
Node should be a part of focus traversal
cycle. |
boolean |
isHover()
Whether or not this
Node is being hovered over. |
boolean |
isManaged()
Defines whether or not this node's layout will be managed by it's parent.
|
boolean |
isMouseTransparent()
If
true , this node (together with all its children) is completely
transparent to mouse events. |
boolean |
isPickOnBounds()
Defines how the picking computation is done for this node when
triggered by a
MouseEvent or a contains function call. |
boolean |
isPressed()
Whether or not the
Node is pressed. |
boolean |
isResizable()
Indicates whether this node is a type which can be resized by its parent.
|
boolean |
isVisible()
Specifies whether this
Node and any subnodes should be rendered
as part of the scene graph. |
ReadOnlyObjectProperty<Bounds> |
layoutBoundsProperty()
The rectangular bounds that should be used for layout calculations for
this node.
|
DoubleProperty |
layoutXProperty()
Defines the x coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
DoubleProperty |
layoutYProperty()
Defines the y coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
Bounds |
localToParent(Bounds localBounds)
Transforms a bounds from the local coordinate space of this
Node into the coordinate space of its parent. |
Point2D |
localToParent(double localX,
double localY)
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its parent. |
Point2D |
localToParent(Point2D localPoint)
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its parent. |
Bounds |
localToScene(Bounds localBounds)
Transforms a bounds from the local coordinate space of this
Node into the coordinate space of its Scene . |
Point2D |
localToScene(double localX,
double localY)
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its Scene . |
Point2D |
localToScene(Point2D localPoint)
Transforms a point from the local coordinate space of this
Node
into the coordinate space of its Scene . |
Node |
lookup(java.lang.String selector)
Finds this
Node , or the first sub-node, based on the given CSS selector. |
java.util.Set<Node> |
lookupAll(java.lang.String selector)
Finds all
Node s, including this one and any children, which match
the given CSS selector. |
BooleanProperty |
managedProperty()
Defines whether or not this node's layout will be managed by it's parent.
|
double |
maxHeight(double width)
Returns the node's maximum height for use in layout calculations.
|
double |
maxWidth(double height)
Returns the node's maximum width for use in layout calculations.
|
double |
minHeight(double width)
Returns the node's minimum height for use in layout calculations.
|
double |
minWidth(double height)
Returns the node's minimum width for use in layout calculations.
|
BooleanProperty |
mouseTransparentProperty()
If
true , this node (together with all its children) is completely
transparent to mouse events. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onDragDetectedProperty()
Defines a function to be called when drag gesture has been
detected.
|
ObjectProperty<EventHandler<? super DragEvent>> |
onDragDoneProperty()
Defines a function to be called when this
Node is a
drag and drop gesture source after its data has
been dropped on a drop target. |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragDroppedProperty()
Defines a function to be called when the mouse button is released
on this
Node during drag and drop gesture. |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragEnteredProperty()
Defines a function to be called when drag gesture
enters this
Node . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragExitedProperty()
Defines a function to be called when drag gesture
exits this
Node . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragOverProperty()
Defines a function to be called when drag gesture progresses within
this
Node . |
ObjectProperty<EventHandler<? super InputMethodEvent>> |
onInputMethodTextChangedProperty()
Defines a function to be called when this
Node
has input focus and the input method text has changed. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyPressedProperty()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been pressed. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyReleasedProperty()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been released. |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyTypedProperty()
Defines a function to be called when this
Node or its child
Node has input focus and a key has been typed. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseClickedProperty()
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseDraggedProperty()
Defines a function to be called when a mouse button is pressed
on this
Node and then dragged. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseEnteredProperty()
Defines a function to be called when the mouse enters this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseExitedProperty()
Defines a function to be called when the mouse exits this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseMovedProperty()
Defines a function to be called when mouse cursor moves within
this
Node but no buttons have been pushed. |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMousePressedProperty()
Defines a function to be called when a mouse button
has been pressed on this
Node . |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseReleasedProperty()
Defines a function to be called when a mouse button
has been released on this
Node . |
ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollProperty()
Defines a function to be called when user performs a scrolling action.
|
DoubleProperty |
opacityProperty()
Specifies how opaque (that is, solid) the
Node appears. |
ReadOnlyObjectProperty<Parent> |
parentProperty()
The parent of this
Node . |
Bounds |
parentToLocal(Bounds parentBounds)
Transforms a rectangle from the coordinate space of the parent into the
local coordinate space of this
Node . |
Point2D |
parentToLocal(double parentX,
double parentY)
Transforms a point from the coordinate space of the parent into the
local coordinate space of this
Node . |
Point2D |
parentToLocal(Point2D parentPoint)
Transforms a point from the coordinate space of the parent into the
local coordinate space of this
Node . |
BooleanProperty |
pickOnBoundsProperty()
Defines how the picking computation is done for this node when
triggered by a
MouseEvent or a contains function call. |
double |
prefHeight(double width)
Returns the node's preferred height for use in layout calculations.
|
double |
prefWidth(double height)
Returns the node's preferred width for use in layout calculations.
|
ReadOnlyBooleanProperty |
pressedProperty()
Whether or not the
Node is pressed. |
void |
relocate(double x,
double y)
Sets the node's layoutX and layoutY translation properties in order to
relocate this node to the x,y location in the parent.
|
<T extends Event> |
removeEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Unregisters a previously registered event filter from this node.
|
<T extends Event> |
removeEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Unregisters a previously registered event handler from this node.
|
void |
requestFocus()
Requests that this
Node get the input focus, and that this
Node 's top-level ancestor become the focused window. |
void |
resize(double width,
double height)
If the node is resizable, will set its layout bounds to the specified
width and height.
|
void |
resizeRelocate(double x,
double y,
double width,
double height)
If the node is resizable, will set its layout bounds to the specified
width and height.
|
DoubleProperty |
rotateProperty()
Defines the angle of rotation about the
Node 's center, measured in
degrees. |
ObjectProperty<Point3D> |
rotationAxisProperty()
Defines the axis of rotation of this
Node . |
DoubleProperty |
scaleXProperty()
Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this
Node . |
DoubleProperty |
scaleYProperty()
Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this
Node . |
DoubleProperty |
scaleZProperty()
Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this
Node . |
ReadOnlyObjectProperty<Scene> |
sceneProperty()
The
Scene that this Node is part of. |
Bounds |
sceneToLocal(Bounds sceneBounds)
Transforms a rectangle from the coordinate space of the
Scene into the local coordinate space of this
Node . |
Point2D |
sceneToLocal(double sceneX,
double sceneY)
Transforms a point from the coordinate space of the
Scene
into the local coordinate space of this Node . |
Point2D |
sceneToLocal(Point2D scenePoint)
Transforms a point from the coordinate space of the
Scene
into the local coordinate space of this Node . |
void |
setBlendMode(BlendMode value)
The
BlendMode used to blend this individual node
into the scene behind it. |
void |
setCache(boolean value)
A performance hint to the system to indicate that this
Node
should be cached as a bitmap. |
void |
setCacheHint(CacheHint value)
Additional hint for controlling bitmap caching.
|
void |
setClip(Node value)
Specifies a
Node to use to define the the clipping shape for this
Node. |
void |
setCursor(Cursor value)
Defines the mouse cursor for this
Node and subnodes. |
void |
setDepthTest(DepthTest value)
Indicates whether depth testing is used when rendering this node.
|
void |
setDisable(boolean value)
Sets the individual disabled state of this
Node . |
protected void |
setDisabled(boolean value)
Indicates whether or not this
Node is disabled. |
void |
setEffect(Effect value)
Specifies an effect to apply to this
Node . |
void |
setEventDispatcher(EventDispatcher value)
Specifies the event dispatcher for this node.
|
protected <T extends Event> |
setEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Sets the handler to use for this event type.
|
protected void |
setFocused(boolean value)
Indicates whether this
Node currently has the input focus. |
void |
setFocusTraversable(boolean value)
Specifies whether this
Node should be a part of focus traversal
cycle. |
protected void |
setHover(boolean value)
Whether or not this
Node is being hovered over. |
void |
setId(java.lang.String value)
The id of this
Node . |
void |
setInputMethodRequests(InputMethodRequests value)
Property holding InputMethodRequests.
|
void |
setLayoutX(double value)
Defines the x coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
void |
setLayoutY(double value)
Defines the y coordinate of the translation that is added to this
Node 's
transform for the purpose of layout. |
void |
setManaged(boolean value)
Defines whether or not this node's layout will be managed by it's parent.
|
void |
setMouseTransparent(boolean value)
If
true , this node (together with all its children) is completely
transparent to mouse events. |
void |
setOnDragDetected(EventHandler<? super MouseEvent> value)
Defines a function to be called when drag gesture has been
detected.
|
void |
setOnDragDone(EventHandler<? super DragEvent> value)
Defines a function to be called when this
Node is a
drag and drop gesture source after its data has
been dropped on a drop target. |
void |
setOnDragDropped(EventHandler<? super DragEvent> value)
Defines a function to be called when the mouse button is released
on this
Node during drag and drop gesture. |
void |
setOnDragEntered(EventHandler<? super DragEvent> value)
Defines a function to be called when drag gesture
enters this
Node . |
void |
setOnDragExited(EventHandler<? super DragEvent> value)
Defines a function to be called when drag gesture
exits this
Node . |
void |
setOnDragOver(EventHandler<? super DragEvent> value)
Defines a function to be called when drag gesture progresses within
this
Node . |
void |
setOnInputMethodTextChanged(EventHandler<? super InputMethodEvent> value)
Defines a function to be called when this
Node
has input focus and the input method text has changed. |
void |
setOnKeyPressed(EventHandler<? super KeyEvent> value)
Defines a function to be called when this
Node or its child
Node has input focus and a key has been pressed. |
void |
setOnKeyReleased(EventHandler<? super KeyEvent> value)
Defines a function to be called when this
Node or its child
Node has input focus and a key has been released. |
void |
setOnKeyTyped(EventHandler<? super KeyEvent> value)
Defines a function to be called when this
Node or its child
Node has input focus and a key has been typed. |
void |
setOnMouseClicked(EventHandler<? super MouseEvent> value)
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Node . |
void |
setOnMouseDragged(EventHandler<? super MouseEvent> value)
Defines a function to be called when a mouse button is pressed
on this
Node and then dragged. |
void |
setOnMouseEntered(EventHandler<? super MouseEvent> value)
Defines a function to be called when the mouse enters this
Node . |
void |
setOnMouseExited(EventHandler<? super MouseEvent> value)
Defines a function to be called when the mouse exits this
Node . |
void |
setOnMouseMoved(EventHandler<? super MouseEvent> value)
Defines a function to be called when mouse cursor moves within
this
Node but no buttons have been pushed. |
void |
setOnMousePressed(EventHandler<? super MouseEvent> value)
Defines a function to be called when a mouse button
has been pressed on this
Node . |
void |
setOnMouseReleased(EventHandler<? super MouseEvent> value)
Defines a function to be called when a mouse button
has been released on this
Node . |
void |
setOnScroll(EventHandler<? super ScrollEvent> value)
Defines a function to be called when user performs a scrolling action.
|
void |
setOpacity(double value)
Specifies how opaque (that is, solid) the
Node appears. |
void |
setPickOnBounds(boolean value)
Defines how the picking computation is done for this node when
triggered by a
MouseEvent or a contains function call. |
protected void |
setPressed(boolean value)
Whether or not the
Node is pressed. |
void |
setRotate(double value)
Defines the angle of rotation about the
Node 's center, measured in
degrees. |
void |
setRotationAxis(Point3D value)
Defines the axis of rotation of this
Node . |
void |
setScaleX(double value)
Defines the factor by which coordinates are scaled about the center of the
object along the X axis of this
Node . |
void |
setScaleY(double value)
Defines the factor by which coordinates are scaled about the center of the
object along the Y axis of this
Node . |
void |
setScaleZ(double value)
Defines the factor by which coordinates are scaled about the center of the
object along the Z axis of this
Node . |
void |
setStyle(java.lang.String value)
A string representation of the CSS style associated with this
specific
Node . |
void |
setTranslateX(double value)
Defines the x coordinate of the translation that is added to this
Node 's
transform. |
void |
setTranslateY(double value)
Defines the y coordinate of the translation that is added to this
Node 's
transform. |
void |
setTranslateZ(double value)
Defines the Z coordinate of the translation that is added to the
transformed coordinates of this
Node . |
void |
setUserData(java.lang.Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
void |
setVisible(boolean value)
Specifies whether this
Node and any subnodes should be rendered
as part of the scene graph. |
Dragboard |
startDragAndDrop(TransferMode... transferModes)
Confirms a potential drag and drop gesture that is recognized over this
Node . |
StringProperty |
styleProperty()
A string representation of the CSS style associated with this
specific
Node . |
void |
toBack()
Moves this
Node to the back of its sibling nodes in terms of
z-order. |
void |
toFront()
Moves this
Node to the front of its sibling nodes in terms of
z-order. |
java.lang.String |
toString()
Returns a string representation for the object.
|
DoubleProperty |
translateXProperty()
Defines the x coordinate of the translation that is added to this
Node 's
transform. |
DoubleProperty |
translateYProperty()
Defines the y coordinate of the translation that is added to this
Node 's
transform. |
DoubleProperty |
translateZProperty()
Defines the Z coordinate of the translation that is added to the
transformed coordinates of this
Node . |
BooleanProperty |
visibleProperty()
Specifies whether this
Node and any subnodes should be rendered
as part of the scene graph. |
Node
. If this Node
has not been added
to a scene graph, then parent will be null.getParent()
Scene
that this Node
is part of. If the Node is not
part of a scene, then this variable will be null.getScene()
Node
. This simple string identifier is useful for
finding a specific Node within the scene graph. While the id of a Node
should be unique within the scene graph, this uniqueness is not enforced.
This is analogous to the "id" attribute on an HTML element
(
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
getId()
,
setId(String)
Node
. This is analogous to the "style" attribute of an
HTML element. Note that, like the HTML style attribute, this
variable contains style properties and values and not the
selector portion of a style rule.getStyle()
,
setStyle(String)
Node
and any subnodes should be rendered
as part of the scene graph. A node may be visible and yet not be shown
in the rendered scene if, for instance, it is off the screen or obscured
by another Node. Invisible nodes never receive mouse events or
keyboard focus, and never maintain keyboard focus when they become
invisible.isVisible()
,
setVisible(boolean)
Node
and subnodes. If null,
then the cursor of the first parent node with a non-null cursor will be
used. If no Node in the scene graph defines a cursor, then the cursor
of the Scene
will be used.getCursor()
,
setCursor(Cursor)
Node
appears. A Node
with 0% opacity is fully translucent. That is, while it is still
visible
and rendered, you generally won't be able to see it. The
exception to this rule is when the ZNode
is combined with a
blending mode and blend effect in which case a translucent Node may still
have an impact in rendering. An opacity of 50% will render the node as
being 50% transparent.
A visible
node with any opacity setting still receives mouse
events and can receive keyboard focus. For example, if you want to have
a large invisible rectangle overlay all Nodes in the scene graph in order
to intercept mouse events but not be visible to the user, you could
create a large Rectangle that had an opacity of 0%.
Opacity is specified as a value between 0 and 1. Values less than 0 are treated as 0, values greater than 1 are treated as 1.
On some platforms ImageView might not support opacity variable.
There is a known limitation of mixing opacity < 1.0 with a 3D Transform.
Opacity/Blending is essentially a 2D image operation. The result of
an opacity < 1.0 set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
getOpacity()
,
setOpacity(double)
BlendMode
used to blend this individual node
into the scene behind it. If this node happens to be a Group then all of the
children will be composited individually into a temporary buffer using their
own blend modes and then that temporary buffer will be composited into the
scene using the specified blend mode.
A value of null
is treated as pass-though this means no effect on a
parent such as a Group and the equivalent of SRC_OVER for a single Node.getBlendMode()
,
setBlendMode(BlendMode)
Node
to use to define the the clipping shape for this
Node. This clipping Node is not a child of this Node
in the scene
graph sense. Rather, it is used to define the clip for this Node
.
For example, you can use an ImageView
Node as
a mask to represent the Clip. Or you could use one of the geometric shape
Nodes such as Rectangle
or
Circle
. Or you could use a
Text
node to represent the Clip.
See the class documentation for Node
for scene graph structure
restrictions on setting the clip. If these restrictions are violated by
a change to the clip variable, the change is ignored and the
previous value of the clip variable is restored.
Note that this is a conditional feature. See
ConditionalFeature.SHAPE_CLIP
for more information.
There is a known limitation of mixing Clip with a 3D Transform.
Clipping is essentially a 2D image operation. The result of
a Clip set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
getClip()
,
setClip(Node)
Node
should be cached as a bitmap. Rendering a bitmap representation of a node
will be faster than rendering primitives in many cases, especially in the
case of primitives with effects applied (such as a blur). However, it
also increases memory usage. This hint indicates whether that trade-off
(increased memory usage for increased performance) is worthwhile. Also
note that on some platforms such as GPU accelerated platforms there is
little benefit to caching Nodes as bitmaps when blurs and other effects
are used since they are very fast to render on the GPU.
The cacheHint
variable provides additional options for enabling
more aggressive bitmap caching.
Caching may be disabled for any node that has a 3D transform on itself, any of its ancestors, or any of its descendants.
cacheHintProperty()
,
isCache()
,
setCache(boolean)
Under certain circumstances, such as animating nodes that are very expensive to render, it is desirable to be able to perform transformations on the node without having to regenerate the cached bitmap. An option in such cases is to perform the transforms on the cached bitmap itself.
This technique can provide a dramatic improvement to animation
performance, though may also result in a reduction in visual quality.
The cacheHint
variable provides a hint to the system about how
and when that trade-off (visual quality for animation performance) is
acceptable.
It is possible to enable the cacheHint only at times when your node is animating. In this way, expensive nodes can appear on screen with full visual quality, yet still animate smoothly.
Example:
expensiveNode.setCache(true);
expensiveNode.setCacheHint(CacheHint.QUALITY);
...
// Do an animation
expensiveNode.setCacheHint(CacheHint.SPEED);
new Timeline(
new KeyFrame(Duration.seconds(2),
new KeyValue(expensiveNode.scaleXProperty(), 2.0),
new KeyValue(expensiveNode.scaleYProperty(), 2.0),
new KeyValue(expensiveNode.rotateProperty(), 360),
new KeyValue(expensiveNode.cacheHintProperty(), CacheHint.QUALITY)
)
).play();
Note that cacheHint
is only a hint to the system. Depending on
the details of the node or the transform, this hint may be ignored.
If Node.cache
is false, cacheHint is ignored.
Caching may be disabled for any node that has a 3D transform on itself,
any of its ancestors, or any of its descendants.
cacheProperty()
,
getCacheHint()
,
setCacheHint(CacheHint)
Node
.
Note that this is a conditional feature. See
ConditionalFeature.EFFECT
for more information.
There is a known limitation of mixing Effect with a 3D Transform. Effect is
essentially a 2D image operation. The result of an Effect set on
a Group
node with 3D transformed children will cause its children
to be rendered in order without Z-buffering applied between those
children.
getEffect()
,
setEffect(Effect)
The depthTest flag is only used when the depthBuffer flag for
the Scene
is true (meaning that the
Scene
has an associated depth buffer)
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
See the constructor in Scene with depthBuffer as one of its input arguments.
Scene
,
getDepthTest()
,
setDepthTest(DepthTest)
Node
. Setting
disable
to true will cause this Node
and any subnodes to
become disabled. This variable should be used only to set the disabled
state of a Node
. For querying the disabled state of a
Node
, the disabled
variable should instead be used,
since it is possible that a Node
was disabled as a result of an
ancestor being disabled even if the individual disable
state on
this Node
is false
.isDisable()
,
setDisable(boolean)
MouseEvent
or a contains
function call.
If pickOnBounds
is true, then picking is computed by
intersecting with the bounds of this node, else picking is computed
by intersecting with the geometric shape of this node.isPickOnBounds()
,
setPickOnBounds(boolean)
Node
is disabled. A Node
will become disabled if disable
is set to true
on either
itself or one of its ancestors in the scene graph.
A disabled Node
should render itself differently to indicate its
disabled state to the user.
Such disabled rendering is dependent on the implementation of the
Node
. The shape classes contained in javafx.scene.shape
do not implement such rendering by default, therefore applications using
shapes for handling input must implement appropriate disabled rendering
themselves. The user-interface controls defined in
javafx.scene.control
will implement disabled-sensitive rendering,
however.
A disabled Node
does not receive mouse or key events.
isDisabled()
,
setDisabled(boolean)
Node
.Node
.Node
.getOnDragOver()
,
setOnDragOver(EventHandler)
Node
is a
drag and drop gesture source after its data has
been dropped on a drop target. The transferMode
of the
event shows what just happened at the drop target.
If transferMode
has the value MOVE
, then the source can
clear out its data. Clearing the source's data gives the appropriate
appearance to a user that the data has been moved by the drag and drop
gesture. A transferMode
that has the value NONE
indicates that no data was transferred during the drag and drop gesture.getOnDragDone()
,
setOnDragDone(EventHandler)
If the node is unmanaged, its parent will ignore the child in both preferred
size computations and layout. Changes in layoutBounds will not trigger
relayout above it. If an unmanaged node is of type Parent
,
it will act as a "layout root", meaning that calls to requestLayout()
beneath it will cause only the branch rooted by the node to be relayed out,
thereby isolating layout changes to that root and below. It's the application's
responsibility to set the size and position of an unmanaged node.
By default all nodes are managed.
isManaged()
,
setManaged(boolean)
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minX
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalX
textnode.setLayoutX(finalX - textnode.getLayoutBounds().getMinX();
Failure to subtract layoutBounds minX
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutX directly.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position
and translateX
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the layout region will set layoutX
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutX
directly to position it.
getLayoutX()
,
setLayoutX(double)
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minY
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalY
textnode.setLayoutY(finalY - textnode.getLayoutBounds().getMinY());
Failure to subtract layoutBounds minY
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutY directly.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position
and translateY
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the region will set layoutY
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutY
directly to position it.
getLayoutY()
,
setLayoutY(double)
Node
which include its transforms.
boundsInParent
is calculated by
taking the local bounds (defined by boundsInLocal
) and applying
the transform created by setting the following additional variables
transforms
ObservableListscaleX
, scaleY
rotate
layoutX
, layoutY
translateX
, translateY
The resulting bounds will be conceptually in the coordinate space of the
Node
's parent, however the node need not have a parent to calculate
these bounds.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInParent is automatically recomputed whenever the geometry of a node changes, or when any of the following the change: transforms ObservableList, translateX, translateY, layoutX, layoutY, scaleX, scaleY, or the rotate variable. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape, or translateX, translateY should never be bound to boundsInParent for the purpose of positioning the node.
getBoundsInParent()
Node
in the node's
untransformed local coordinate space. For nodes that extend
Shape
, the local bounds will also include
space required for a non-zero stroke that may fall outside the shape's
geometry that is defined by position and size attributes.
The local bounds will also include any clipping set with clip
as well as effects set with effect
.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInLocal is automatically recomputed whenever the geometry of a node changes. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape should never be bound to boundsInLocal for the purpose of positioning the node.
getBoundsInLocal()
layoutBounds
may differ from the visual bounds
of the node and is computed differently depending on the node type.
If the node type is resizable (Region
,
Control
, or WebView
)
then the layoutBounds will always be 0,0 width x height
.
If the node type is not resizable (Shape
,
Text
, or Group
), then the layoutBounds
are computed based on the node's geometric properties and does not include the
node's clip, effect, or transforms. See individual class documentation
for details.
Note that the layoutX
, layoutY
, translateX
, and
translateY
variables are not included in the layoutBounds.
This is important because layout code must first determine the current
size and location of the node (using layoutBounds) and then set
layoutX
and layoutY
to adjust the translation of the
node so that it will have the desired layout position.
Because the computation of layoutBounds is often tied to a node's
geometric variables, it is an error to bind any such variables to an
expression that depends upon layoutBounds
. For example, the
x or y variables of a shape should never be bound to layoutBounds
for the purpose of positioning the node.
The layoutBounds will never be null.
getLayoutBounds()
Node
's
transform.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position and translateX
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
getTranslateX()
,
setTranslateX(double)
Node
's
transform.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position and translateY
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
getTranslateY()
,
setTranslateY(double)
Node
. This value will be added
to any translation defined by the transforms
ObservableList and
layoutZ
.
This variable can be used to alter the location of a Node without disturbing its layout bounds, which makes it useful for animating a node's location.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getTranslateZ()
,
setTranslateZ(double)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
getScaleX()
,
setScaleX(double)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
getScaleY()
,
setScaleY(double)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
rectangular bounds formed by taking boundsInLocal
and applying
all the transforms in the transforms
ObservableList.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getScaleZ()
,
setScaleZ(double)
Node
's center, measured in
degrees. This is used to rotate the Node
.
This rotation factor is not included in layoutBounds
by
default, which makes it ideal for rotating the entire node after
all effects and transforms have been taken into account.
The pivot point about which the rotation occurs is the center of the
untransformed layoutBounds
.
Note that because the pivot point is computed as the center of this
Node
's layout bounds, any change to the layout bounds will cause
the pivot point to change, which can move the object. For a leaf node,
any change to the geometry will cause the layout bounds to change.
For a group node, any change to any of its children, including a
change in a child's geometry, clip, effect, position, orientation, or
scale, will cause the group's layout bounds to change. If this movement
of the pivot point is not
desired, applications should instead use the Node's transforms
ObservableList, and add a Rotate
transform,
which has a user-specifiable pivot point.
getRotate()
,
setRotate(double)
Node
.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getRotationAxis()
,
setRotationAxis(Point3D)
true
, this node (together with all its children) is completely
transparent to mouse events. When choosing target for mouse event, nodes
with mouseTransparent
set to true
and their subtrees
won't be taken into account.Node
is being hovered over. Typically this is
due to the mouse being over the node, though it could be due to a pen
hovering on a graphics tablet or other form of input.
the NOTE current implementation of hover relies on mouse enter and exit events to determine whether this Node is in the hover state; this means that this feature is currently supported only on systems that have a mouse. Future implementations may provide alternative means of supporting hover.
isHover()
,
setHover(boolean)
Node
is pressed. Typically this is true when
the primary mouse button is down, though subclasses may define other
mouse button state or key state to cause the node to be "pressed".isPressed()
,
setPressed(boolean)
Node
.Node
and then dragged.Node
.Node
.Node
but no buttons have been pushed.Node
.Node
.getOnScroll()
,
setOnScroll(EventHandler)
Node
or its child
Node
has input focus and a key has been pressed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.Node
or its child
Node
has input focus and a key has been released. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.Node
or its child
Node
has input focus and a key has been typed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.getOnKeyTyped()
,
setOnKeyTyped(EventHandler)
Node
has input focus and the input method text has changed. If this
function is not defined in this Node
, then it
receives the result string of the input method composition as a
series of onKeyTyped
function calls.
When the Node
loses the input focus, the JavaFX runtime
automatically commits the existing composed text if any.getInputMethodRequests()
,
setInputMethodRequests(InputMethodRequests)
Node
currently has the input focus.
To have the input focus, a node must be the Scene
's focus
owner, and the scene must be in a Stage
that is visible
and active. See requestFocus()
for more information.isFocused()
,
setFocused(boolean)
Node
should be a part of focus traversal
cycle. When this property is true
focus can be moved to this
Node
and from this Node
using regular focus traversal
keys. On a desktop such keys are usually TAB
for moving focus
forward and SHIFT+TAB
for moving focus backward.
When a Scene
is created, the system gives focus to a
Node
whose focusTraversable
variable is true
and that is eligible to receive the focus,
unless the focus had been set explicitly via a call
to requestFocus()
.EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.public final ObservableMap<java.lang.Object,java.lang.Object> getProperties()
public boolean hasProperties()
public void setUserData(java.lang.Object value)
getUserData()
.value
- The value to be stored - this can later be retrieved by calling
getUserData()
.public java.lang.Object getUserData()
setUserData(java.lang.Object)
method.public final Parent getParent()
Node
. If this Node
has not been added
to a scene graph, then parent will be null.public final ReadOnlyObjectProperty<Parent> parentProperty()
Node
. If this Node
has not been added
to a scene graph, then parent will be null.getParent()
public final Scene getScene()
Scene
that this Node
is part of. If the Node is not
part of a scene, then this variable will be null.public final ReadOnlyObjectProperty<Scene> sceneProperty()
Scene
that this Node
is part of. If the Node is not
part of a scene, then this variable will be null.getScene()
public final void setId(java.lang.String value)
Node
. This simple string identifier is useful for
finding a specific Node within the scene graph. While the id of a Node
should be unique within the scene graph, this uniqueness is not enforced.
This is analogous to the "id" attribute on an HTML element
(
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
public final java.lang.String getId()
Node
. This simple string identifier is useful for
finding a specific Node within the scene graph. While the id of a Node
should be unique within the scene graph, this uniqueness is not enforced.
This is analogous to the "id" attribute on an HTML element
(Node
using the setId
method or null
, if no id has been assigned.public final StringProperty idProperty()
Node
. This simple string identifier is useful for
finding a specific Node within the scene graph. While the id of a Node
should be unique within the scene graph, this uniqueness is not enforced.
This is analogous to the "id" attribute on an HTML element
(
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
getId()
,
setId(String)
public final ObservableList<java.lang.String> getStyleClass()
public final void setStyle(java.lang.String value)
Node
. This is analogous to the "style" attribute of an
HTML element. Note that, like the HTML style attribute, this
variable contains style properties and values and not the
selector portion of a style rule.public final java.lang.String getStyle()
Node
. This is analogous to the "style" attribute of an
HTML element. Note that, like the HTML style attribute, this
variable contains style properties and values and not the
selector portion of a style rule.Node
.
If this Node
does not have an inline style,
an empty String is returned.public final StringProperty styleProperty()
Node
. This is analogous to the "style" attribute of an
HTML element. Note that, like the HTML style attribute, this
variable contains style properties and values and not the
selector portion of a style rule.getStyle()
,
setStyle(String)
public final void setVisible(boolean value)
Node
and any subnodes should be rendered
as part of the scene graph. A node may be visible and yet not be shown
in the rendered scene if, for instance, it is off the screen or obscured
by another Node. Invisible nodes never receive mouse events or
keyboard focus, and never maintain keyboard focus when they become
invisible.public final boolean isVisible()
Node
and any subnodes should be rendered
as part of the scene graph. A node may be visible and yet not be shown
in the rendered scene if, for instance, it is off the screen or obscured
by another Node. Invisible nodes never receive mouse events or
keyboard focus, and never maintain keyboard focus when they become
invisible.public final BooleanProperty visibleProperty()
Node
and any subnodes should be rendered
as part of the scene graph. A node may be visible and yet not be shown
in the rendered scene if, for instance, it is off the screen or obscured
by another Node. Invisible nodes never receive mouse events or
keyboard focus, and never maintain keyboard focus when they become
invisible.isVisible()
,
setVisible(boolean)
public final void setCursor(Cursor value)
Node
and subnodes. If null,
then the cursor of the first parent node with a non-null cursor will be
used. If no Node in the scene graph defines a cursor, then the cursor
of the Scene
will be used.public final Cursor getCursor()
Node
and subnodes. If null,
then the cursor of the first parent node with a non-null cursor will be
used. If no Node in the scene graph defines a cursor, then the cursor
of the Scene
will be used.public final ObjectProperty<Cursor> cursorProperty()
Node
and subnodes. If null,
then the cursor of the first parent node with a non-null cursor will be
used. If no Node in the scene graph defines a cursor, then the cursor
of the Scene
will be used.getCursor()
,
setCursor(Cursor)
public final void setOpacity(double value)
Node
appears. A Node
with 0% opacity is fully translucent. That is, while it is still
visible
and rendered, you generally won't be able to see it. The
exception to this rule is when the ZNode
is combined with a
blending mode and blend effect in which case a translucent Node may still
have an impact in rendering. An opacity of 50% will render the node as
being 50% transparent.
A visible
node with any opacity setting still receives mouse
events and can receive keyboard focus. For example, if you want to have
a large invisible rectangle overlay all Nodes in the scene graph in order
to intercept mouse events but not be visible to the user, you could
create a large Rectangle that had an opacity of 0%.
Opacity is specified as a value between 0 and 1. Values less than 0 are treated as 0, values greater than 1 are treated as 1.
On some platforms ImageView might not support opacity variable.
There is a known limitation of mixing opacity < 1.0 with a 3D Transform.
Opacity/Blending is essentially a 2D image operation. The result of
an opacity < 1.0 set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
public final double getOpacity()
Node
appears. A Node
with 0% opacity is fully translucent. That is, while it is still
visible
and rendered, you generally won't be able to see it. The
exception to this rule is when the ZNode
is combined with a
blending mode and blend effect in which case a translucent Node may still
have an impact in rendering. An opacity of 50% will render the node as
being 50% transparent.
A visible
node with any opacity setting still receives mouse
events and can receive keyboard focus. For example, if you want to have
a large invisible rectangle overlay all Nodes in the scene graph in order
to intercept mouse events but not be visible to the user, you could
create a large Rectangle that had an opacity of 0%.
Opacity is specified as a value between 0 and 1. Values less than 0 are treated as 0, values greater than 1 are treated as 1.
On some platforms ImageView might not support opacity variable.
There is a known limitation of mixing opacity < 1.0 with a 3D Transform.
Opacity/Blending is essentially a 2D image operation. The result of
an opacity < 1.0 set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
public final DoubleProperty opacityProperty()
Node
appears. A Node
with 0% opacity is fully translucent. That is, while it is still
visible
and rendered, you generally won't be able to see it. The
exception to this rule is when the ZNode
is combined with a
blending mode and blend effect in which case a translucent Node may still
have an impact in rendering. An opacity of 50% will render the node as
being 50% transparent.
A visible
node with any opacity setting still receives mouse
events and can receive keyboard focus. For example, if you want to have
a large invisible rectangle overlay all Nodes in the scene graph in order
to intercept mouse events but not be visible to the user, you could
create a large Rectangle that had an opacity of 0%.
Opacity is specified as a value between 0 and 1. Values less than 0 are treated as 0, values greater than 1 are treated as 1.
On some platforms ImageView might not support opacity variable.
There is a known limitation of mixing opacity < 1.0 with a 3D Transform.
Opacity/Blending is essentially a 2D image operation. The result of
an opacity < 1.0 set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
getOpacity()
,
setOpacity(double)
public final void setBlendMode(BlendMode value)
BlendMode
used to blend this individual node
into the scene behind it. If this node happens to be a Group then all of the
children will be composited individually into a temporary buffer using their
own blend modes and then that temporary buffer will be composited into the
scene using the specified blend mode.
A value of null
is treated as pass-though this means no effect on a
parent such as a Group and the equivalent of SRC_OVER for a single Node.public final BlendMode getBlendMode()
BlendMode
used to blend this individual node
into the scene behind it. If this node happens to be a Group then all of the
children will be composited individually into a temporary buffer using their
own blend modes and then that temporary buffer will be composited into the
scene using the specified blend mode.
A value of null
is treated as pass-though this means no effect on a
parent such as a Group and the equivalent of SRC_OVER for a single Node.public final ObjectProperty<BlendMode> blendModeProperty()
BlendMode
used to blend this individual node
into the scene behind it. If this node happens to be a Group then all of the
children will be composited individually into a temporary buffer using their
own blend modes and then that temporary buffer will be composited into the
scene using the specified blend mode.
A value of null
is treated as pass-though this means no effect on a
parent such as a Group and the equivalent of SRC_OVER for a single Node.getBlendMode()
,
setBlendMode(BlendMode)
public final void setClip(Node value)
Node
to use to define the the clipping shape for this
Node. This clipping Node is not a child of this Node
in the scene
graph sense. Rather, it is used to define the clip for this Node
.
For example, you can use an ImageView
Node as
a mask to represent the Clip. Or you could use one of the geometric shape
Nodes such as Rectangle
or
Circle
. Or you could use a
Text
node to represent the Clip.
See the class documentation for Node
for scene graph structure
restrictions on setting the clip. If these restrictions are violated by
a change to the clip variable, the change is ignored and the
previous value of the clip variable is restored.
Note that this is a conditional feature. See
ConditionalFeature.SHAPE_CLIP
for more information.
There is a known limitation of mixing Clip with a 3D Transform.
Clipping is essentially a 2D image operation. The result of
a Clip set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
public final Node getClip()
Node
to use to define the the clipping shape for this
Node. This clipping Node is not a child of this Node
in the scene
graph sense. Rather, it is used to define the clip for this Node
.
For example, you can use an ImageView
Node as
a mask to represent the Clip. Or you could use one of the geometric shape
Nodes such as Rectangle
or
Circle
. Or you could use a
Text
node to represent the Clip.
See the class documentation for Node
for scene graph structure
restrictions on setting the clip. If these restrictions are violated by
a change to the clip variable, the change is ignored and the
previous value of the clip variable is restored.
Note that this is a conditional feature. See
ConditionalFeature.SHAPE_CLIP
for more information.
There is a known limitation of mixing Clip with a 3D Transform.
Clipping is essentially a 2D image operation. The result of
a Clip set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
public final ObjectProperty<Node> clipProperty()
Node
to use to define the the clipping shape for this
Node. This clipping Node is not a child of this Node
in the scene
graph sense. Rather, it is used to define the clip for this Node
.
For example, you can use an ImageView
Node as
a mask to represent the Clip. Or you could use one of the geometric shape
Nodes such as Rectangle
or
Circle
. Or you could use a
Text
node to represent the Clip.
See the class documentation for Node
for scene graph structure
restrictions on setting the clip. If these restrictions are violated by
a change to the clip variable, the change is ignored and the
previous value of the clip variable is restored.
Note that this is a conditional feature. See
ConditionalFeature.SHAPE_CLIP
for more information.
There is a known limitation of mixing Clip with a 3D Transform.
Clipping is essentially a 2D image operation. The result of
a Clip set on a Group
node with 3D transformed children
will cause its children to be rendered in order without Z-buffering
applied between those children.
getClip()
,
setClip(Node)
public final void setCache(boolean value)
Node
should be cached as a bitmap. Rendering a bitmap representation of a node
will be faster than rendering primitives in many cases, especially in the
case of primitives with effects applied (such as a blur). However, it
also increases memory usage. This hint indicates whether that trade-off
(increased memory usage for increased performance) is worthwhile. Also
note that on some platforms such as GPU accelerated platforms there is
little benefit to caching Nodes as bitmaps when blurs and other effects
are used since they are very fast to render on the GPU.
The cacheHint
variable provides additional options for enabling
more aggressive bitmap caching.
Caching may be disabled for any node that has a 3D transform on itself, any of its ancestors, or any of its descendants.
public final boolean isCache()
Node
should be cached as a bitmap. Rendering a bitmap representation of a node
will be faster than rendering primitives in many cases, especially in the
case of primitives with effects applied (such as a blur). However, it
also increases memory usage. This hint indicates whether that trade-off
(increased memory usage for increased performance) is worthwhile. Also
note that on some platforms such as GPU accelerated platforms there is
little benefit to caching Nodes as bitmaps when blurs and other effects
are used since they are very fast to render on the GPU.
The cacheHint
variable provides additional options for enabling
more aggressive bitmap caching.
Caching may be disabled for any node that has a 3D transform on itself, any of its ancestors, or any of its descendants.
public final BooleanProperty cacheProperty()
Node
should be cached as a bitmap. Rendering a bitmap representation of a node
will be faster than rendering primitives in many cases, especially in the
case of primitives with effects applied (such as a blur). However, it
also increases memory usage. This hint indicates whether that trade-off
(increased memory usage for increased performance) is worthwhile. Also
note that on some platforms such as GPU accelerated platforms there is
little benefit to caching Nodes as bitmaps when blurs and other effects
are used since they are very fast to render on the GPU.
The cacheHint
variable provides additional options for enabling
more aggressive bitmap caching.
Caching may be disabled for any node that has a 3D transform on itself, any of its ancestors, or any of its descendants.
cacheHintProperty()
,
isCache()
,
setCache(boolean)
public final void setCacheHint(CacheHint value)
Under certain circumstances, such as animating nodes that are very expensive to render, it is desirable to be able to perform transformations on the node without having to regenerate the cached bitmap. An option in such cases is to perform the transforms on the cached bitmap itself.
This technique can provide a dramatic improvement to animation
performance, though may also result in a reduction in visual quality.
The cacheHint
variable provides a hint to the system about how
and when that trade-off (visual quality for animation performance) is
acceptable.
It is possible to enable the cacheHint only at times when your node is animating. In this way, expensive nodes can appear on screen with full visual quality, yet still animate smoothly.
Example:
expensiveNode.setCache(true);
expensiveNode.setCacheHint(CacheHint.QUALITY);
...
// Do an animation
expensiveNode.setCacheHint(CacheHint.SPEED);
new Timeline(
new KeyFrame(Duration.seconds(2),
new KeyValue(expensiveNode.scaleXProperty(), 2.0),
new KeyValue(expensiveNode.scaleYProperty(), 2.0),
new KeyValue(expensiveNode.rotateProperty(), 360),
new KeyValue(expensiveNode.cacheHintProperty(), CacheHint.QUALITY)
)
).play();
Note that cacheHint
is only a hint to the system. Depending on
the details of the node or the transform, this hint may be ignored.
If Node.cache
is false, cacheHint is ignored.
Caching may be disabled for any node that has a 3D transform on itself,
any of its ancestors, or any of its descendants.
public final CacheHint getCacheHint()
Under certain circumstances, such as animating nodes that are very expensive to render, it is desirable to be able to perform transformations on the node without having to regenerate the cached bitmap. An option in such cases is to perform the transforms on the cached bitmap itself.
This technique can provide a dramatic improvement to animation
performance, though may also result in a reduction in visual quality.
The cacheHint
variable provides a hint to the system about how
and when that trade-off (visual quality for animation performance) is
acceptable.
It is possible to enable the cacheHint only at times when your node is animating. In this way, expensive nodes can appear on screen with full visual quality, yet still animate smoothly.
Example:
expensiveNode.setCache(true);
expensiveNode.setCacheHint(CacheHint.QUALITY);
...
// Do an animation
expensiveNode.setCacheHint(CacheHint.SPEED);
new Timeline(
new KeyFrame(Duration.seconds(2),
new KeyValue(expensiveNode.scaleXProperty(), 2.0),
new KeyValue(expensiveNode.scaleYProperty(), 2.0),
new KeyValue(expensiveNode.rotateProperty(), 360),
new KeyValue(expensiveNode.cacheHintProperty(), CacheHint.QUALITY)
)
).play();
Note that cacheHint
is only a hint to the system. Depending on
the details of the node or the transform, this hint may be ignored.
If Node.cache
is false, cacheHint is ignored.
Caching may be disabled for any node that has a 3D transform on itself,
any of its ancestors, or any of its descendants.
public final ObjectProperty<CacheHint> cacheHintProperty()
Under certain circumstances, such as animating nodes that are very expensive to render, it is desirable to be able to perform transformations on the node without having to regenerate the cached bitmap. An option in such cases is to perform the transforms on the cached bitmap itself.
This technique can provide a dramatic improvement to animation
performance, though may also result in a reduction in visual quality.
The cacheHint
variable provides a hint to the system about how
and when that trade-off (visual quality for animation performance) is
acceptable.
It is possible to enable the cacheHint only at times when your node is animating. In this way, expensive nodes can appear on screen with full visual quality, yet still animate smoothly.
Example:
expensiveNode.setCache(true);
expensiveNode.setCacheHint(CacheHint.QUALITY);
...
// Do an animation
expensiveNode.setCacheHint(CacheHint.SPEED);
new Timeline(
new KeyFrame(Duration.seconds(2),
new KeyValue(expensiveNode.scaleXProperty(), 2.0),
new KeyValue(expensiveNode.scaleYProperty(), 2.0),
new KeyValue(expensiveNode.rotateProperty(), 360),
new KeyValue(expensiveNode.cacheHintProperty(), CacheHint.QUALITY)
)
).play();
Note that cacheHint
is only a hint to the system. Depending on
the details of the node or the transform, this hint may be ignored.
If Node.cache
is false, cacheHint is ignored.
Caching may be disabled for any node that has a 3D transform on itself,
any of its ancestors, or any of its descendants.
cacheProperty()
,
getCacheHint()
,
setCacheHint(CacheHint)
public final void setEffect(Effect value)
Node
.
Note that this is a conditional feature. See
ConditionalFeature.EFFECT
for more information.
There is a known limitation of mixing Effect with a 3D Transform. Effect is
essentially a 2D image operation. The result of an Effect set on
a Group
node with 3D transformed children will cause its children
to be rendered in order without Z-buffering applied between those
children.
public final Effect getEffect()
Node
.
Note that this is a conditional feature. See
ConditionalFeature.EFFECT
for more information.
There is a known limitation of mixing Effect with a 3D Transform. Effect is
essentially a 2D image operation. The result of an Effect set on
a Group
node with 3D transformed children will cause its children
to be rendered in order without Z-buffering applied between those
children.
public final ObjectProperty<Effect> effectProperty()
Node
.
Note that this is a conditional feature. See
ConditionalFeature.EFFECT
for more information.
There is a known limitation of mixing Effect with a 3D Transform. Effect is
essentially a 2D image operation. The result of an Effect set on
a Group
node with 3D transformed children will cause its children
to be rendered in order without Z-buffering applied between those
children.
getEffect()
,
setEffect(Effect)
public final void setDepthTest(DepthTest value)
The depthTest flag is only used when the depthBuffer flag for
the Scene
is true (meaning that the
Scene
has an associated depth buffer)
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
See the constructor in Scene with depthBuffer as one of its input arguments.
public final DepthTest getDepthTest()
The depthTest flag is only used when the depthBuffer flag for
the Scene
is true (meaning that the
Scene
has an associated depth buffer)
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
See the constructor in Scene with depthBuffer as one of its input arguments.
public final ObjectProperty<DepthTest> depthTestProperty()
The depthTest flag is only used when the depthBuffer flag for
the Scene
is true (meaning that the
Scene
has an associated depth buffer)
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
See the constructor in Scene with depthBuffer as one of its input arguments.
Scene
,
getDepthTest()
,
setDepthTest(DepthTest)
public final void setDisable(boolean value)
Node
. Setting
disable
to true will cause this Node
and any subnodes to
become disabled. This variable should be used only to set the disabled
state of a Node
. For querying the disabled state of a
Node
, the disabled
variable should instead be used,
since it is possible that a Node
was disabled as a result of an
ancestor being disabled even if the individual disable
state on
this Node
is false
.public final boolean isDisable()
Node
. Setting
disable
to true will cause this Node
and any subnodes to
become disabled. This variable should be used only to set the disabled
state of a Node
. For querying the disabled state of a
Node
, the disabled
variable should instead be used,
since it is possible that a Node
was disabled as a result of an
ancestor being disabled even if the individual disable
state on
this Node
is false
.public final BooleanProperty disableProperty()
Node
. Setting
disable
to true will cause this Node
and any subnodes to
become disabled. This variable should be used only to set the disabled
state of a Node
. For querying the disabled state of a
Node
, the disabled
variable should instead be used,
since it is possible that a Node
was disabled as a result of an
ancestor being disabled even if the individual disable
state on
this Node
is false
.isDisable()
,
setDisable(boolean)
public final void setPickOnBounds(boolean value)
MouseEvent
or a contains
function call.
If pickOnBounds
is true, then picking is computed by
intersecting with the bounds of this node, else picking is computed
by intersecting with the geometric shape of this node.public final boolean isPickOnBounds()
MouseEvent
or a contains
function call.
If pickOnBounds
is true, then picking is computed by
intersecting with the bounds of this node, else picking is computed
by intersecting with the geometric shape of this node.public final BooleanProperty pickOnBoundsProperty()
MouseEvent
or a contains
function call.
If pickOnBounds
is true, then picking is computed by
intersecting with the bounds of this node, else picking is computed
by intersecting with the geometric shape of this node.isPickOnBounds()
,
setPickOnBounds(boolean)
protected final void setDisabled(boolean value)
Node
is disabled. A Node
will become disabled if disable
is set to true
on either
itself or one of its ancestors in the scene graph.
A disabled Node
should render itself differently to indicate its
disabled state to the user.
Such disabled rendering is dependent on the implementation of the
Node
. The shape classes contained in javafx.scene.shape
do not implement such rendering by default, therefore applications using
shapes for handling input must implement appropriate disabled rendering
themselves. The user-interface controls defined in
javafx.scene.control
will implement disabled-sensitive rendering,
however.
A disabled Node
does not receive mouse or key events.
public final boolean isDisabled()
Node
is disabled. A Node
will become disabled if disable
is set to true
on either
itself or one of its ancestors in the scene graph.
A disabled Node
should render itself differently to indicate its
disabled state to the user.
Such disabled rendering is dependent on the implementation of the
Node
. The shape classes contained in javafx.scene.shape
do not implement such rendering by default, therefore applications using
shapes for handling input must implement appropriate disabled rendering
themselves. The user-interface controls defined in
javafx.scene.control
will implement disabled-sensitive rendering,
however.
A disabled Node
does not receive mouse or key events.
public final ReadOnlyBooleanProperty disabledProperty()
Node
is disabled. A Node
will become disabled if disable
is set to true
on either
itself or one of its ancestors in the scene graph.
A disabled Node
should render itself differently to indicate its
disabled state to the user.
Such disabled rendering is dependent on the implementation of the
Node
. The shape classes contained in javafx.scene.shape
do not implement such rendering by default, therefore applications using
shapes for handling input must implement appropriate disabled rendering
themselves. The user-interface controls defined in
javafx.scene.control
will implement disabled-sensitive rendering,
however.
A disabled Node
does not receive mouse or key events.
isDisabled()
,
setDisabled(boolean)
public Node lookup(java.lang.String selector)
Node
, or the first sub-node, based on the given CSS selector.
If this node is a Parent
, then this function will traverse down
into the branch until it finds a match. If more than one sub-node matches the
specified selector, this function returns the first of them.
For example, if a Node is given the id of "myId", then the lookup method can
be used to find this node as follows: scene.lookup("#myId");
.
selector
- The css selector of the node to findNode
, which matches
the CSS selector
, null if none is found.public java.util.Set<Node> lookupAll(java.lang.String selector)
Node
s, including this one and any children, which match
the given CSS selector. If no matches are found, an empty unmodifiable set is
returned. The set is explicitly unordered.selector
- The css selector of the nodes to findNode
, which match
the CSS selector
. The returned set is always unordered and
unmodifiable, and never null.public void toBack()
Node
to the back of its sibling nodes in terms of
z-order. This is accomplished by moving this Node
to the
first position in its parent's content
ObservableList.
This function has no effect if this Node
is not part of a group.public void toFront()
Node
to the front of its sibling nodes in terms of
z-order. This is accomplished by moving this Node
to the
last position in its parent's content
ObservableList.
This function has no effect if this Node
is not part of a group.public final void setOnDragEntered(EventHandler<? super DragEvent> value)
Node
.public final EventHandler<? super DragEvent> getOnDragEntered()
Node
.public final ObjectProperty<EventHandler<? super DragEvent>> onDragEnteredProperty()
Node
.public final void setOnDragExited(EventHandler<? super DragEvent> value)
Node
.public final EventHandler<? super DragEvent> getOnDragExited()
Node
.public final ObjectProperty<EventHandler<? super DragEvent>> onDragExitedProperty()
Node
.public final void setOnDragOver(EventHandler<? super DragEvent> value)
Node
.public final EventHandler<? super DragEvent> getOnDragOver()
Node
.public final ObjectProperty<EventHandler<? super DragEvent>> onDragOverProperty()
Node
.getOnDragOver()
,
setOnDragOver(EventHandler)
public final void setOnDragDropped(EventHandler<? super DragEvent> value)
public final EventHandler<? super DragEvent> getOnDragDropped()
public final ObjectProperty<EventHandler<? super DragEvent>> onDragDroppedProperty()
public final void setOnDragDone(EventHandler<? super DragEvent> value)
Node
is a
drag and drop gesture source after its data has
been dropped on a drop target. The transferMode
of the
event shows what just happened at the drop target.
If transferMode
has the value MOVE
, then the source can
clear out its data. Clearing the source's data gives the appropriate
appearance to a user that the data has been moved by the drag and drop
gesture. A transferMode
that has the value NONE
indicates that no data was transferred during the drag and drop gesture.public final EventHandler<? super DragEvent> getOnDragDone()
Node
is a
drag and drop gesture source after its data has
been dropped on a drop target. The transferMode
of the
event shows what just happened at the drop target.
If transferMode
has the value MOVE
, then the source can
clear out its data. Clearing the source's data gives the appropriate
appearance to a user that the data has been moved by the drag and drop
gesture. A transferMode
that has the value NONE
indicates that no data was transferred during the drag and drop gesture.public final ObjectProperty<EventHandler<? super DragEvent>> onDragDoneProperty()
Node
is a
drag and drop gesture source after its data has
been dropped on a drop target. The transferMode
of the
event shows what just happened at the drop target.
If transferMode
has the value MOVE
, then the source can
clear out its data. Clearing the source's data gives the appropriate
appearance to a user that the data has been moved by the drag and drop
gesture. A transferMode
that has the value NONE
indicates that no data was transferred during the drag and drop gesture.getOnDragDone()
,
setOnDragDone(EventHandler)
public Dragboard startDragAndDrop(TransferMode... transferModes)
Node
.
Can be called only from a DRAG_DETECTED event handler. The returned
Dragboard
is used to transfer data during
the drag and drop gesture. Placing this Node
's data on the
Dragboard
also identifies this Node
as the source of
the drag and drop gesture.
More detail about drag and drop gestures is described in the overivew
of DragEvent
.transferModes
- The supported TransferMode
(s) of this Node
Dragboard
to place this Node
's data onjava.lang.IllegalStateException
- if drag and drop cannot be started at this
moment (it's called outside of DRAG_DETECTED
event handling or
this node is not in scene).DragEvent
public final void setManaged(boolean value)
If the node is unmanaged, its parent will ignore the child in both preferred
size computations and layout. Changes in layoutBounds will not trigger
relayout above it. If an unmanaged node is of type Parent
,
it will act as a "layout root", meaning that calls to requestLayout()
beneath it will cause only the branch rooted by the node to be relayed out,
thereby isolating layout changes to that root and below. It's the application's
responsibility to set the size and position of an unmanaged node.
By default all nodes are managed.
public final boolean isManaged()
If the node is unmanaged, its parent will ignore the child in both preferred
size computations and layout. Changes in layoutBounds will not trigger
relayout above it. If an unmanaged node is of type Parent
,
it will act as a "layout root", meaning that calls to requestLayout()
beneath it will cause only the branch rooted by the node to be relayed out,
thereby isolating layout changes to that root and below. It's the application's
responsibility to set the size and position of an unmanaged node.
By default all nodes are managed.
public final BooleanProperty managedProperty()
If the node is unmanaged, its parent will ignore the child in both preferred
size computations and layout. Changes in layoutBounds will not trigger
relayout above it. If an unmanaged node is of type Parent
,
it will act as a "layout root", meaning that calls to requestLayout()
beneath it will cause only the branch rooted by the node to be relayed out,
thereby isolating layout changes to that root and below. It's the application's
responsibility to set the size and position of an unmanaged node.
By default all nodes are managed.
isManaged()
,
setManaged(boolean)
public final void setLayoutX(double value)
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minX
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalX
textnode.setLayoutX(finalX - textnode.getLayoutBounds().getMinX();
Failure to subtract layoutBounds minX
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutX directly.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position
and translateX
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the layout region will set layoutX
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutX
directly to position it.
public final double getLayoutX()
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minX
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalX
textnode.setLayoutX(finalX - textnode.getLayoutBounds().getMinX();
Failure to subtract layoutBounds minX
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutX directly.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position
and translateX
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the layout region will set layoutX
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutX
directly to position it.
public final DoubleProperty layoutXProperty()
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minX
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalX
textnode.setLayoutX(finalX - textnode.getLayoutBounds().getMinX();
Failure to subtract layoutBounds minX
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutX directly.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position
and translateX
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the layout region will set layoutX
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutX
directly to position it.
getLayoutX()
,
setLayoutX(double)
public final void setLayoutY(double value)
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minY
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalY
textnode.setLayoutY(finalY - textnode.getLayoutBounds().getMinY());
Failure to subtract layoutBounds minY
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutY directly.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position
and translateY
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the region will set layoutY
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutY
directly to position it.
public final double getLayoutY()
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minY
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalY
textnode.setLayoutY(finalY - textnode.getLayoutBounds().getMinY());
Failure to subtract layoutBounds minY
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutY directly.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position
and translateY
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the region will set layoutY
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutY
directly to position it.
public final DoubleProperty layoutYProperty()
Node
's
transform for the purpose of layout. The value should be computed as the
offset required to adjust the position of the node from its current
layoutBounds minY
position (which might not be 0) to the desired location.
For example, if textnode
should be positioned at finalY
textnode.setLayoutY(finalY - textnode.getLayoutBounds().getMinY());
Failure to subtract layoutBounds minY
may result in misplacement
of the node. The relocate(x,y)
method will automatically do the
correct computation and should generally be used over setting layoutY directly.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position
and translateY
optionally makes dynamic adjustments to that
position.
If the node is managed and has a Region
as its parent, then the region will set layoutY
according to its
own layout policy. If the node is unmanaged or parented by a Group
,
then the application may set layoutY
directly to position it.
getLayoutY()
,
setLayoutY(double)
public void relocate(double x, double y)
This method does not alter translateX or translateY, which if also set will be added to layoutX and layoutY, adjusting the final location by corresponding amounts.
x
- the target x coordinate locationy
- the target y coordinate locationpublic boolean isResizable()
If this method returns false, then the parent cannot resize it during layout (resize() is a no-op) and it should return its layoutBounds for minimum, preferred, and maximum sizes. Group, Text, and all Shapes are not resizable and hence depend on the application to establish their sizing by setting appropriate properties (e.g. width/height for Rectangle, text on Text, and so on). Non-resizable nodes may still be relocated during layout.
getContentBias()
,
minWidth(double)
,
minHeight(double)
,
prefWidth(double)
,
prefHeight(double)
,
maxWidth(double)
,
maxHeight(double)
,
resize(double, double)
,
getLayoutBounds()
public Orientation getContentBias()
Resizable subclasses should override this method to return an appropriate value.
isResizable()
,
minWidth(double)
,
minHeight(double)
,
prefWidth(double)
,
prefHeight(double)
,
maxWidth(double)
,
maxHeight(double)
public double minWidth(double height)
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the minimum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
height
- the height that should be used if minimum width depends on itisResizable()
,
getContentBias()
public double minHeight(double width)
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the minimum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
width
- the width that should be used if minimum height depends on itisResizable()
,
getContentBias()
public double prefWidth(double height)
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the preferred width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
height
- the height that should be used if preferred width depends on itisResizable()
,
getContentBias()
,
autosize()
public double prefHeight(double width)
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the preferred height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
width
- the width that should be used if preferred height depends on itgetContentBias()
,
autosize()
public double maxWidth(double height)
If the node is not resizable, returns its layoutBounds width.
Layout code which calls this method should first check the content-bias of the node. If the node has a vertical content-bias, then callers should pass in a height value that the maximum width should be based on. If the node has either a horizontal or null content-bias, then the caller should pass in -1.
Node subclasses with a vertical content-bias should honor the height parameter whether -1 or a positive value. All other subclasses may ignore the height parameter (which will likely be -1).
height
- the height that should be used if maximum width depends on itisResizable()
,
getContentBias()
public double maxHeight(double width)
If the node is not resizable, returns its layoutBounds height.
Layout code which calls this method should first check the content-bias of the node. If the node has a horizontal content-bias, then callers should pass in a width value that the maximum height should be based on. If the node has either a vertical or null content-bias, then the caller should pass in -1.
Node subclasses with a horizontal content-bias should honor the width parameter whether -1 or a positive value. All other subclasses may ignore the width parameter (which will likely be -1).
width
- the width that should be used if maximum height depends on itisResizable()
,
getContentBias()
public void resize(double width, double height)
This method should generally only be called by parent nodes from their layoutChildren() methods. All Parent classes will automatically resize resizable children, so resizing done directly by the application will be overridden by the node's parent, unless the child is unmanaged.
Parents are responsible for ensuring the width and height values fall within the resizable node's preferred range. The autosize() method may be used if the parent just needs to resize the node to its preferred size.
width
- the target layout bounds widthheight
- the target layout bounds heightisResizable()
,
getContentBias()
,
autosize()
,
minWidth(double)
,
minHeight(double)
,
prefWidth(double)
,
prefHeight(double)
,
maxWidth(double)
,
maxHeight(double)
,
getLayoutBounds()
public final void autosize()
This method automatically queries the node's content-bias and if it's horizontal, will pass in the node's preferred width to get the preferred height; if vertical, will pass in the node's preferred height to get the width, and if null, will compute the preferred width/height independently.
isResizable()
,
getContentBias()
public void resizeRelocate(double x, double y, double width, double height)
Once the node has been resized (if resizable) then sets the node's layoutX and layoutY translation properties in order to relocate it to x,y in the parent's coordinate space.
This method should generally only be called by parent nodes from their layoutChildren() methods. All Parent classes will automatically resize resizable children, so resizing done directly by the application will be overridden by the node's parent, unless the child is unmanaged.
Parents are responsible for ensuring the width and height values fall within the resizable node's preferred range. The autosize() and relocate() methods may be used if the parent just needs to resize the node to its preferred size and reposition it.
x
- the target x coordinate locationy
- the target y coordinate locationwidth
- the target layout bounds widthheight
- the target layout bounds heightisResizable()
,
getContentBias()
,
autosize()
,
minWidth(double)
,
minHeight(double)
,
prefWidth(double)
,
prefHeight(double)
,
maxWidth(double)
,
maxHeight(double)
public double getBaselineOffset()
public final Bounds getBoundsInParent()
Node
which include its transforms.
boundsInParent
is calculated by
taking the local bounds (defined by boundsInLocal
) and applying
the transform created by setting the following additional variables
transforms
ObservableListscaleX
, scaleY
rotate
layoutX
, layoutY
translateX
, translateY
The resulting bounds will be conceptually in the coordinate space of the
Node
's parent, however the node need not have a parent to calculate
these bounds.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInParent is automatically recomputed whenever the geometry of a node changes, or when any of the following the change: transforms ObservableList, translateX, translateY, layoutX, layoutY, scaleX, scaleY, or the rotate variable. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape, or translateX, translateY should never be bound to boundsInParent for the purpose of positioning the node.
public final ReadOnlyObjectProperty<Bounds> boundsInParentProperty()
Node
which include its transforms.
boundsInParent
is calculated by
taking the local bounds (defined by boundsInLocal
) and applying
the transform created by setting the following additional variables
transforms
ObservableListscaleX
, scaleY
rotate
layoutX
, layoutY
translateX
, translateY
The resulting bounds will be conceptually in the coordinate space of the
Node
's parent, however the node need not have a parent to calculate
these bounds.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInParent is automatically recomputed whenever the geometry of a node changes, or when any of the following the change: transforms ObservableList, translateX, translateY, layoutX, layoutY, scaleX, scaleY, or the rotate variable. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape, or translateX, translateY should never be bound to boundsInParent for the purpose of positioning the node.
getBoundsInParent()
public final Bounds getBoundsInLocal()
Node
in the node's
untransformed local coordinate space. For nodes that extend
Shape
, the local bounds will also include
space required for a non-zero stroke that may fall outside the shape's
geometry that is defined by position and size attributes.
The local bounds will also include any clipping set with clip
as well as effects set with effect
.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInLocal is automatically recomputed whenever the geometry of a node changes. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape should never be bound to boundsInLocal for the purpose of positioning the node.
public final ReadOnlyObjectProperty<Bounds> boundsInLocalProperty()
Node
in the node's
untransformed local coordinate space. For nodes that extend
Shape
, the local bounds will also include
space required for a non-zero stroke that may fall outside the shape's
geometry that is defined by position and size attributes.
The local bounds will also include any clipping set with clip
as well as effects set with effect
.
Note that this method does not take the node's visibility into account;
the computation is based on the geometry of this Node
only.
This property will always have a non-null value.
Note that boundsInLocal is automatically recomputed whenever the geometry of a node changes. For this reason, it is an error to bind any of these values in a node to an expression that depends upon this variable. For example, the x or y variables of a shape should never be bound to boundsInLocal for the purpose of positioning the node.
getBoundsInLocal()
public final Bounds getLayoutBounds()
layoutBounds
may differ from the visual bounds
of the node and is computed differently depending on the node type.
If the node type is resizable (Region
,
Control
, or WebView
)
then the layoutBounds will always be 0,0 width x height
.
If the node type is not resizable (Shape
,
Text
, or Group
), then the layoutBounds
are computed based on the node's geometric properties and does not include the
node's clip, effect, or transforms. See individual class documentation
for details.
Note that the layoutX
, layoutY
, translateX
, and
translateY
variables are not included in the layoutBounds.
This is important because layout code must first determine the current
size and location of the node (using layoutBounds) and then set
layoutX
and layoutY
to adjust the translation of the
node so that it will have the desired layout position.
Because the computation of layoutBounds is often tied to a node's
geometric variables, it is an error to bind any such variables to an
expression that depends upon layoutBounds
. For example, the
x or y variables of a shape should never be bound to layoutBounds
for the purpose of positioning the node.
The layoutBounds will never be null.
public final ReadOnlyObjectProperty<Bounds> layoutBoundsProperty()
layoutBounds
may differ from the visual bounds
of the node and is computed differently depending on the node type.
If the node type is resizable (Region
,
Control
, or WebView
)
then the layoutBounds will always be 0,0 width x height
.
If the node type is not resizable (Shape
,
Text
, or Group
), then the layoutBounds
are computed based on the node's geometric properties and does not include the
node's clip, effect, or transforms. See individual class documentation
for details.
Note that the layoutX
, layoutY
, translateX
, and
translateY
variables are not included in the layoutBounds.
This is important because layout code must first determine the current
size and location of the node (using layoutBounds) and then set
layoutX
and layoutY
to adjust the translation of the
node so that it will have the desired layout position.
Because the computation of layoutBounds is often tied to a node's
geometric variables, it is an error to bind any such variables to an
expression that depends upon layoutBounds
. For example, the
x or y variables of a shape should never be bound to layoutBounds
for the purpose of positioning the node.
The layoutBounds will never be null.
getLayoutBounds()
public boolean contains(double localX, double localY)
true
if the given point (specified in the local
coordinate space of this Node
) is contained within the shape of
this Node
. Note that this method does not take visibility into
account; the test is based on the geometry of this Node
only.public boolean contains(Point2D localPoint)
true
if the given point (specified in the local
coordinate space of this Node
) is contained within the shape of
this Node
. Note that this method does not take visibility into
account; the test is based on the geometry of this Node
only.public boolean intersects(double localX, double localY, double localWidth, double localHeight)
true
if the given rectangle (specified in the local
coordinate space of this Node
) intersects the shape of this
Node
. Note that this method does not take visibility into
account; the test is based on the geometry of this Node
only.
The default behavior of this function is simply to check if the
given coordinates intersect with the local bounds.public boolean intersects(Bounds localBounds)
true
if the given bounds (specified in the local
coordinate space of this Node
) intersects the shape of this
Node
. Note that this method does not take visibility into
account; the test is based on the geometry of this Node
only.
The default behavior of this function is simply to check if the
given coordinates intersect with the local bounds.public Point2D sceneToLocal(double sceneX, double sceneY)
Scene
into the local coordinate space of this Node
.public Point2D sceneToLocal(Point2D scenePoint)
Scene
into the local coordinate space of this Node
.public Bounds sceneToLocal(Bounds sceneBounds)
Scene
into the local coordinate space of this
Node
.public Point2D localToScene(double localX, double localY)
Node
into the coordinate space of its Scene
.public Point2D localToScene(Point2D localPoint)
Node
into the coordinate space of its Scene
.public Bounds localToScene(Bounds localBounds)
Node
into the coordinate space of its Scene
.public Point2D parentToLocal(double parentX, double parentY)
Node
.public Point2D parentToLocal(Point2D parentPoint)
Node
.public Bounds parentToLocal(Bounds parentBounds)
Node
.public Point2D localToParent(double localX, double localY)
Node
into the coordinate space of its parent.public Point2D localToParent(Point2D localPoint)
Node
into the coordinate space of its parent.public Bounds localToParent(Bounds localBounds)
Node
into the coordinate space of its parent.public final ObservableList<Transform> getTransforms()
Transform
objects
to be applied to this Node
. This ObservableList of transforms is applied
before translateX
, translateY
, scaleX
, and
scaleY
, rotate
transforms.public final void setTranslateX(double value)
Node
's
transform.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position and translateX
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
public final double getTranslateX()
Node
's
transform.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position and translateX
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
public final DoubleProperty translateXProperty()
Node
's
transform.
The node's final translation will be computed as layoutX
+ translateX
,
where layoutX
establishes the node's stable position and translateX
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
getTranslateX()
,
setTranslateX(double)
public final void setTranslateY(double value)
Node
's
transform.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position and translateY
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
public final double getTranslateY()
Node
's
transform.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position and translateY
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
public final DoubleProperty translateYProperty()
Node
's
transform.
The node's final translation will be computed as layoutY
+ translateY
,
where layoutY
establishes the node's stable position and translateY
optionally makes dynamic adjustments to that position.
This variable can be used to alter the location of a node without disturbing
its layoutBounds
, which makes it useful for animating a node's location.
getTranslateY()
,
setTranslateY(double)
public final void setTranslateZ(double value)
Node
. This value will be added
to any translation defined by the transforms
ObservableList and
layoutZ
.
This variable can be used to alter the location of a Node without disturbing its layout bounds, which makes it useful for animating a node's location.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final double getTranslateZ()
Node
. This value will be added
to any translation defined by the transforms
ObservableList and
layoutZ
.
This variable can be used to alter the location of a Node without disturbing its layout bounds, which makes it useful for animating a node's location.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final DoubleProperty translateZProperty()
Node
. This value will be added
to any translation defined by the transforms
ObservableList and
layoutZ
.
This variable can be used to alter the location of a Node without disturbing its layout bounds, which makes it useful for animating a node's location.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getTranslateZ()
,
setTranslateZ(double)
public final void setScaleX(double value)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
public final double getScaleX()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
public final DoubleProperty scaleXProperty()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
getScaleX()
,
setScaleX(double)
public final void setScaleY(double value)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
public final double getScaleY()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
public final DoubleProperty scaleYProperty()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
untransformed layoutBounds
.
getScaleY()
,
setScaleY(double)
public final void setScaleZ(double value)
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
rectangular bounds formed by taking boundsInLocal
and applying
all the transforms in the transforms
ObservableList.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final double getScaleZ()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
rectangular bounds formed by taking boundsInLocal
and applying
all the transforms in the transforms
ObservableList.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final DoubleProperty scaleZProperty()
Node
. This is used to stretch or
animate the node either manually or by using an animation.
This scale factor is not included in layoutBounds
by
default, which makes it ideal for scaling the entire node after
all effects and transforms have been taken into account.
The pivot point about which the scale occurs is the center of the
rectangular bounds formed by taking boundsInLocal
and applying
all the transforms in the transforms
ObservableList.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getScaleZ()
,
setScaleZ(double)
public final void setRotate(double value)
Node
's center, measured in
degrees. This is used to rotate the Node
.
This rotation factor is not included in layoutBounds
by
default, which makes it ideal for rotating the entire node after
all effects and transforms have been taken into account.
The pivot point about which the rotation occurs is the center of the
untransformed layoutBounds
.
Note that because the pivot point is computed as the center of this
Node
's layout bounds, any change to the layout bounds will cause
the pivot point to change, which can move the object. For a leaf node,
any change to the geometry will cause the layout bounds to change.
For a group node, any change to any of its children, including a
change in a child's geometry, clip, effect, position, orientation, or
scale, will cause the group's layout bounds to change. If this movement
of the pivot point is not
desired, applications should instead use the Node's transforms
ObservableList, and add a Rotate
transform,
which has a user-specifiable pivot point.
public final double getRotate()
Node
's center, measured in
degrees. This is used to rotate the Node
.
This rotation factor is not included in layoutBounds
by
default, which makes it ideal for rotating the entire node after
all effects and transforms have been taken into account.
The pivot point about which the rotation occurs is the center of the
untransformed layoutBounds
.
Note that because the pivot point is computed as the center of this
Node
's layout bounds, any change to the layout bounds will cause
the pivot point to change, which can move the object. For a leaf node,
any change to the geometry will cause the layout bounds to change.
For a group node, any change to any of its children, including a
change in a child's geometry, clip, effect, position, orientation, or
scale, will cause the group's layout bounds to change. If this movement
of the pivot point is not
desired, applications should instead use the Node's transforms
ObservableList, and add a Rotate
transform,
which has a user-specifiable pivot point.
public final DoubleProperty rotateProperty()
Node
's center, measured in
degrees. This is used to rotate the Node
.
This rotation factor is not included in layoutBounds
by
default, which makes it ideal for rotating the entire node after
all effects and transforms have been taken into account.
The pivot point about which the rotation occurs is the center of the
untransformed layoutBounds
.
Note that because the pivot point is computed as the center of this
Node
's layout bounds, any change to the layout bounds will cause
the pivot point to change, which can move the object. For a leaf node,
any change to the geometry will cause the layout bounds to change.
For a group node, any change to any of its children, including a
change in a child's geometry, clip, effect, position, orientation, or
scale, will cause the group's layout bounds to change. If this movement
of the pivot point is not
desired, applications should instead use the Node's transforms
ObservableList, and add a Rotate
transform,
which has a user-specifiable pivot point.
getRotate()
,
setRotate(double)
public final void setRotationAxis(Point3D value)
Node
.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final Point3D getRotationAxis()
Node
.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
public final ObjectProperty<Point3D> rotationAxisProperty()
Node
.
Note that this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
getRotationAxis()
,
setRotationAxis(Point3D)
public final void setMouseTransparent(boolean value)
true
, this node (together with all its children) is completely
transparent to mouse events. When choosing target for mouse event, nodes
with mouseTransparent
set to true
and their subtrees
won't be taken into account.public final boolean isMouseTransparent()
true
, this node (together with all its children) is completely
transparent to mouse events. When choosing target for mouse event, nodes
with mouseTransparent
set to true
and their subtrees
won't be taken into account.public final BooleanProperty mouseTransparentProperty()
true
, this node (together with all its children) is completely
transparent to mouse events. When choosing target for mouse event, nodes
with mouseTransparent
set to true
and their subtrees
won't be taken into account.protected final void setHover(boolean value)
Node
is being hovered over. Typically this is
due to the mouse being over the node, though it could be due to a pen
hovering on a graphics tablet or other form of input.
the NOTE current implementation of hover relies on mouse enter and exit events to determine whether this Node is in the hover state; this means that this feature is currently supported only on systems that have a mouse. Future implementations may provide alternative means of supporting hover.
public final boolean isHover()
Node
is being hovered over. Typically this is
due to the mouse being over the node, though it could be due to a pen
hovering on a graphics tablet or other form of input.
the NOTE current implementation of hover relies on mouse enter and exit events to determine whether this Node is in the hover state; this means that this feature is currently supported only on systems that have a mouse. Future implementations may provide alternative means of supporting hover.
public final ReadOnlyBooleanProperty hoverProperty()
Node
is being hovered over. Typically this is
due to the mouse being over the node, though it could be due to a pen
hovering on a graphics tablet or other form of input.
the NOTE current implementation of hover relies on mouse enter and exit events to determine whether this Node is in the hover state; this means that this feature is currently supported only on systems that have a mouse. Future implementations may provide alternative means of supporting hover.
isHover()
,
setHover(boolean)
protected final void setPressed(boolean value)
Node
is pressed. Typically this is true when
the primary mouse button is down, though subclasses may define other
mouse button state or key state to cause the node to be "pressed".public final boolean isPressed()
Node
is pressed. Typically this is true when
the primary mouse button is down, though subclasses may define other
mouse button state or key state to cause the node to be "pressed".public final ReadOnlyBooleanProperty pressedProperty()
Node
is pressed. Typically this is true when
the primary mouse button is down, though subclasses may define other
mouse button state or key state to cause the node to be "pressed".isPressed()
,
setPressed(boolean)
public final void setOnMouseClicked(EventHandler<? super MouseEvent> value)
Node
.public final EventHandler<? super MouseEvent> getOnMouseClicked()
Node
.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseClickedProperty()
Node
.public final void setOnMouseDragged(EventHandler<? super MouseEvent> value)
Node
and then dragged.public final EventHandler<? super MouseEvent> getOnMouseDragged()
Node
and then dragged.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseDraggedProperty()
Node
and then dragged.public final void setOnMouseEntered(EventHandler<? super MouseEvent> value)
Node
.public final EventHandler<? super MouseEvent> getOnMouseEntered()
Node
.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseEnteredProperty()
Node
.public final void setOnMouseExited(EventHandler<? super MouseEvent> value)
Node
.public final EventHandler<? super MouseEvent> getOnMouseExited()
Node
.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseExitedProperty()
Node
.public final void setOnMouseMoved(EventHandler<? super MouseEvent> value)
Node
but no buttons have been pushed.public final EventHandler<? super MouseEvent> getOnMouseMoved()
Node
but no buttons have been pushed.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseMovedProperty()
Node
but no buttons have been pushed.public final void setOnMousePressed(EventHandler<? super MouseEvent> value)
Node
.public final EventHandler<? super MouseEvent> getOnMousePressed()
Node
.public final ObjectProperty<EventHandler<? super MouseEvent>> onMousePressedProperty()
Node
.public final void setOnMouseReleased(EventHandler<? super MouseEvent> value)
Node
.public final EventHandler<? super MouseEvent> getOnMouseReleased()
Node
.public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseReleasedProperty()
Node
.public final void setOnDragDetected(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnDragDetected()
public final ObjectProperty<EventHandler<? super MouseEvent>> onDragDetectedProperty()
public final void setOnScroll(EventHandler<? super ScrollEvent> value)
public final EventHandler<? super ScrollEvent> getOnScroll()
public final ObjectProperty<EventHandler<? super ScrollEvent>> onScrollProperty()
getOnScroll()
,
setOnScroll(EventHandler)
public final void setOnKeyPressed(EventHandler<? super KeyEvent> value)
Node
or its child
Node
has input focus and a key has been pressed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final EventHandler<? super KeyEvent> getOnKeyPressed()
Node
or its child
Node
has input focus and a key has been pressed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyPressedProperty()
Node
or its child
Node
has input focus and a key has been pressed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final void setOnKeyReleased(EventHandler<? super KeyEvent> value)
Node
or its child
Node
has input focus and a key has been released. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final EventHandler<? super KeyEvent> getOnKeyReleased()
Node
or its child
Node
has input focus and a key has been released. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyReleasedProperty()
Node
or its child
Node
has input focus and a key has been released. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final void setOnKeyTyped(EventHandler<? super KeyEvent> value)
Node
or its child
Node
has input focus and a key has been typed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final EventHandler<? super KeyEvent> getOnKeyTyped()
Node
or its child
Node
has input focus and a key has been typed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyTypedProperty()
Node
or its child
Node
has input focus and a key has been typed. The function
is called only if the event hasn't been already consumed during its
capturing or bubbling phase.getOnKeyTyped()
,
setOnKeyTyped(EventHandler)
public final void setOnInputMethodTextChanged(EventHandler<? super InputMethodEvent> value)
Node
has input focus and the input method text has changed. If this
function is not defined in this Node
, then it
receives the result string of the input method composition as a
series of onKeyTyped
function calls.
When the Node
loses the input focus, the JavaFX runtime
automatically commits the existing composed text if any.public final EventHandler<? super InputMethodEvent> getOnInputMethodTextChanged()
Node
has input focus and the input method text has changed. If this
function is not defined in this Node
, then it
receives the result string of the input method composition as a
series of onKeyTyped
function calls.
When the Node
loses the input focus, the JavaFX runtime
automatically commits the existing composed text if any.public final ObjectProperty<EventHandler<? super InputMethodEvent>> onInputMethodTextChangedProperty()
Node
has input focus and the input method text has changed. If this
function is not defined in this Node
, then it
receives the result string of the input method composition as a
series of onKeyTyped
function calls.
When the Node
loses the input focus, the JavaFX runtime
automatically commits the existing composed text if any.public final void setInputMethodRequests(InputMethodRequests value)
public final InputMethodRequests getInputMethodRequests()
public final ObjectProperty<InputMethodRequests> inputMethodRequestsProperty()
getInputMethodRequests()
,
setInputMethodRequests(InputMethodRequests)
protected final void setFocused(boolean value)
Node
currently has the input focus.
To have the input focus, a node must be the Scene
's focus
owner, and the scene must be in a Stage
that is visible
and active. See requestFocus()
for more information.public final boolean isFocused()
Node
currently has the input focus.
To have the input focus, a node must be the Scene
's focus
owner, and the scene must be in a Stage
that is visible
and active. See requestFocus()
for more information.public final ReadOnlyBooleanProperty focusedProperty()
Node
currently has the input focus.
To have the input focus, a node must be the Scene
's focus
owner, and the scene must be in a Stage
that is visible
and active. See requestFocus()
for more information.isFocused()
,
setFocused(boolean)
public final void setFocusTraversable(boolean value)
Node
should be a part of focus traversal
cycle. When this property is true
focus can be moved to this
Node
and from this Node
using regular focus traversal
keys. On a desktop such keys are usually TAB
for moving focus
forward and SHIFT+TAB
for moving focus backward.
When a Scene
is created, the system gives focus to a
Node
whose focusTraversable
variable is true
and that is eligible to receive the focus,
unless the focus had been set explicitly via a call
to requestFocus()
.public final boolean isFocusTraversable()
Node
should be a part of focus traversal
cycle. When this property is true
focus can be moved to this
Node
and from this Node
using regular focus traversal
keys. On a desktop such keys are usually TAB
for moving focus
forward and SHIFT+TAB
for moving focus backward.
When a Scene
is created, the system gives focus to a
Node
whose focusTraversable
variable is true
and that is eligible to receive the focus,
unless the focus had been set explicitly via a call
to requestFocus()
.public final BooleanProperty focusTraversableProperty()
Node
should be a part of focus traversal
cycle. When this property is true
focus can be moved to this
Node
and from this Node
using regular focus traversal
keys. On a desktop such keys are usually TAB
for moving focus
forward and SHIFT+TAB
for moving focus backward.
When a Scene
is created, the system gives focus to a
Node
whose focusTraversable
variable is true
and that is eligible to receive the focus,
unless the focus had been set explicitly via a call
to requestFocus()
.public void requestFocus()
Node
get the input focus, and that this
Node
's top-level ancestor become the focused window. To be
eligible to receive the focus, the node must be part of a scene, it and
all of its ancestors must be visible, and it must not be disabled.
If this node is eligible, this function will cause it to become this
Scene
's "focus owner". Each scene has at most one focus owner
node. The focus owner will not actually have the input focus, however,
unless the scene belongs to a Stage
that is both visible
and active.public java.lang.String toString()
toString
in class java.lang.Object
public final void setEventDispatcher(EventDispatcher value)
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.public final EventDispatcher getEventDispatcher()
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.public final ObjectProperty<EventDispatcher> eventDispatcherProperty()
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.public final <T extends Event> void addEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
Event
of the specified type during the bubbling
phase of event delivery.T
- the specific event class of the handlereventType
- the type of the events to receive by the handlereventHandler
- the handler to registerpublic final <T extends Event> void removeEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
T
- the specific event class of the handlereventType
- the event type from which to unregistereventHandler
- the handler to unregisterpublic final <T extends Event> void addEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
Event
of the specified type during the capturing
phase of event delivery.T
- the specific event class of the filtereventType
- the type of the events to receive by the filtereventFilter
- the filter to registerpublic final <T extends Event> void removeEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
T
- the specific event class of the filtereventType
- the event type from which to unregistereventFilter
- the filter to unregisterprotected final <T extends Event> void setEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
T
- the specific event class of the handlereventType
- the event type to associate with the given eventHandlereventHandler
- the handler to register, or null to unregisterpublic EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
buildEventDispatchChain
in interface EventTarget
tail
- the initial chain to build frompublic final void fireEvent(Event event)
This method must be called on the FX user thread.
event
- the event to fireCopyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. Use is subject to