@DefaultProperty(value="root") public class Scene extends java.lang.Object implements EventTarget
Scene
class is the container for all content in a scene graph.
The background of the scene is filled as specified by the fill
property.
The application must specify the root Node
for the scene graph by setting
the root
property. If a Group
is used as the root, the
contents of the scene graph will be clipped by the scene's width and height and
changes to the scene's size (if user resizes the stage) will not alter the
layout of the scene graph. If a resizable node (layout Region
or
Control
is set as the root, then the root's size will track the
scene's size, causing the contents to be relayed out as necessary.
The scene's size may be initialized by the application during construction. If no size is specified, the scene will automatically compute its initial size based on the preferred size of its content. If only one dimension is specified, the other dimension is computed using the specified dimension, respecting content bias of a root.
An application may request depth buffer support or scene anti-aliasing
support at the creation of a Scene
. A scene with only 2D shapes and
without any 3D transforms does not need a depth buffer nor scene
anti-aliasing support. A scene containing 3D shapes or 2D shapes with 3D
transforms may use depth buffer support for proper depth sorted rendering; to
avoid depth fighting (also known as Z fighting), disable depth testing on 2D
shapes that have no 3D transforms. See
depthTest
for more information. A scene with
3D shapes may enable scene anti-aliasing to improve its rendering quality.
The depthBuffer and antiAliasing flags are conditional features. With the
respective default values of: false and SceneAntialiasing.DISABLED
.
See ConditionalFeature.SCENE3D
for more information.
A default headlight will be added to a scene that contains one or more
Shape3D
nodes, but no light nodes. This light source is a
Color.WHITE
PointLight
placed at the camera position.
Scene objects must be constructed and modified on the JavaFX Application Thread.
Example:
import javafx.scene.*; import javafx.scene.paint.*; import javafx.scene.shape.*; Group root = new Group(); Scene s = new Scene(root, 300, 300, Color.BLACK); Rectangle r = new Rectangle(25,25,250,250); r.setFill(Color.BLUE); root.getChildren().add(r);
Modifier and Type | Class and Description |
---|---|
(package private) static class |
Scene.ClickCounter
*
Mouse Event Handling *
*
|
(package private) static class |
Scene.ClickGenerator |
private static class |
Scene.DirtyBits |
(package private) class |
Scene.DnDGesture
A Drag and Drop gesture has a lifespan that lasts from mouse
PRESSED event to mouse RELEASED event.
|
private static class |
Scene.DragDetectedState
State of a drag gesture with regards to DRAG_DETECTED event.
|
(package private) class |
Scene.DragGestureListener |
(package private) class |
Scene.DragSourceListener |
(package private) class |
Scene.DropTargetListener
*
Drag and Drop *
*
|
private class |
Scene.EffectiveOrientationProperty |
(package private) class |
Scene.InputMethodRequestsDelegate |
(package private) class |
Scene.KeyHandler
*
Key Event Handling *
*
|
(package private) class |
Scene.MouseHandler |
(package private) class |
Scene.ScenePeerListener
*
Scene Peer Listener *
*
|
private class |
Scene.ScenePeerPaintListener |
(package private) class |
Scene.ScenePulseListener
*
Scene Pulse Listener *
*
|
private static class |
Scene.TargetWrapper |
private static class |
Scene.TouchGesture |
private static class |
Scene.TouchMap |
Modifier and Type | Field and Description |
---|---|
(package private) java.security.AccessControlContext |
acc |
private Accessible |
accessible |
private java.util.Map<Node,Accessible> |
accMap |
private static boolean |
allowPGAccess |
private SceneAntialiasing |
antiAliasing |
private ObjectProperty<Camera> |
camera
Specifies the type of camera use for rendering this
Scene . |
private Scene.ClickGenerator |
clickGenerator |
private ObjectProperty<Cursor> |
cursor
Defines the mouse cursor for this
Scene . |
private Point2D |
cursorScenePos |
private Point2D |
cursorScreenPos |
private Camera |
defaultCamera |
private static NodeOrientation |
defaultNodeOrientation
*
Component Orientation Properties *
*
|
private boolean |
depthBuffer |
private int |
dirtyBits |
private Node[] |
dirtyNodes
Set of dirty nodes; processed once per frame by the synchronizer.
|
private int |
dirtyNodesSize |
(package private) Scene.DnDGesture |
dndGesture |
(package private) Scene.DragGestureListener |
dragGestureListener |
private NodeOrientation |
effectiveNodeOrientation |
private Scene.EffectiveOrientationProperty |
effectiveNodeOrientationProperty |
private ObjectProperty<EventDispatcher> |
eventDispatcher
Specifies the event dispatcher for this scene.
|
private ObjectProperty<Paint> |
fill
Defines the background fill of this
Scene . |
private boolean |
focusDirty
Set to true if something has happened to the focused node that makes
it no longer eligible to have the focus.
|
private ReadOnlyObjectWrapper<Node> |
focusOwner
The scene's current focus owner node.
|
private ReadOnlyDoubleWrapper |
height
The height of this
Scene |
private double |
heightSetByUser |
private TKScene |
impl_peer
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
private static boolean |
inMousePick |
private static boolean |
inSynchronizer |
private SceneEventDispatcher |
internalEventDispatcher |
private Scene.KeyHandler |
keyHandler
*
Key Events and Focus Traversal *
*
|
private java.util.List<LightBase> |
lights |
private static int |
MIN_DIRTY_CAPACITY |
private Scene.MouseHandler |
mouseHandler |
private TouchEvent |
nextTouchEvent |
private ObjectProperty<NodeOrientation> |
nodeOrientation |
private Node |
oldFocusOwner |
(package private) Parent |
oldRoot |
private ObjectProperty<EventHandler<? super ContextMenuEvent>> |
onContextMenuRequested
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onDragDetected
Defines a function to be called when drag gesture has been
detected.
|
private ObjectProperty<EventHandler<? super DragEvent>> |
onDragDone |
private ObjectProperty<EventHandler<? super DragEvent>> |
onDragDropped |
private ObjectProperty<EventHandler<? super DragEvent>> |
onDragEntered
*
Drag and Drop Handling *
*
|
private ObjectProperty<EventHandler<? super DragEvent>> |
onDragExited |
private ObjectProperty<EventHandler<? super DragEvent>> |
onDragOver |
private ObjectProperty<EventHandler<? super InputMethodEvent>> |
onInputMethodTextChanged
Defines a function to be called when this
Node
has input focus and the input method text has changed. |
private ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyPressed
Defines a function to be called when some
Node of this
Scene has input focus and a key has been pressed. |
private ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyReleased
Defines a function to be called when some
Node of this
Scene has input focus and a key has been released. |
private ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyTyped
Defines a function to be called when some
Node of this
Scene has input focus and a key has been typed. |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseClicked
Defines a function to be called when a mouse button has been clicked
(pressed and released) on this
Scene . |
private ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragEntered
Defines a function to be called when a full press-drag-release gesture
enters this
Scene . |
private ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragExited
Defines a function to be called when a full press-drag-release gesture
exits this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseDragged
Defines a function to be called when a mouse button is pressed
on this
Scene and then dragged. |
private ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragOver
Defines a function to be called when a full press-drag-release gesture
progresses within this
Scene . |
private ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragReleased
Defines a function to be called when a full press-drag-release gesture
ends within this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseEntered
Defines a function to be called when the mouse enters this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseExited
Defines a function to be called when the mouse exits this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseMoved
Defines a function to be called when mouse cursor moves within
this
Scene but no buttons have been pushed. |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMousePressed
Defines a function to be called when a mouse button
has been pressed on this
Scene . |
private ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseReleased
Defines a function to be called when a mouse button
has been released on this
Scene . |
private ObjectProperty<EventHandler<? super RotateEvent>> |
onRotate
Defines a function to be called when user performs a rotating action.
|
private ObjectProperty<EventHandler<? super RotateEvent>> |
onRotationFinished
Defines a function to be called when a rotating gesture ends.
|
private ObjectProperty<EventHandler<? super RotateEvent>> |
onRotationStarted
Defines a function to be called when a rotating gesture is detected.
|
private ObjectProperty<EventHandler<? super ScrollEvent>> |
onScroll
Defines a function to be called when user performs a scrolling action.
|
private ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollFinished
Defines a function to be called when a scrolling gesture ends.
|
private ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollStarted
Defines a function to be called when a scrolling gesture is detected.
|
private ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeDown
Defines a function to be called when an downward swipe gesture
happens in this scene.
|
private ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeLeft
Defines a function to be called when an leftward swipe gesture
happens in this scene.
|
private ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeRight
Defines a function to be called when an rightward swipe gesture
happens in this scene.
|
private ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeUp
Defines a function to be called when an upward swipe gesture
happens in this scene.
|
private ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchMoved
Defines a function to be called when a touch point is moved.
|
private ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchPressed
Defines a function to be called when a new touch point is pressed.
|
private ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchReleased
Defines a function to be called when a new touch point is pressed.
|
private ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchStationary
Defines a function to be called when a touch point stays pressed and
still.
|
private ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoom
Defines a function to be called when user performs a zooming action.
|
private ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoomFinished
Defines a function to be called when a zooming gesture ends.
|
private ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoomStarted
Defines a function to be called when a zooming gesture is detected.
|
private static boolean |
paused |
private static int |
pgAccessCount |
private static boolean |
PLATFORM_DRAG_GESTURE_INITIATION
If true, use the platform's drag gesture detection
else use Scene-level detection as per DnDGesture.process(MouseEvent, List)
|
private ObservableMap<java.lang.Object,java.lang.Object> |
properties |
private ObjectProperty<Parent> |
root
Defines the root
Node of the scene graph. |
private Scene.TouchGesture |
rotateGesture |
(package private) Scene.ScenePulseListener |
scenePulseListener
The scene pulse listener that gets called on toolkit pulses
|
private Scene.TouchGesture |
scrollGesture |
private boolean |
sizeInitialized |
private static TKPulseListener |
snapshotPulseListener |
private static java.util.List<java.lang.Runnable> |
snapshotRunnableList |
private static java.util.List<java.lang.Runnable> |
snapshotRunnableListA |
private static java.util.List<java.lang.Runnable> |
snapshotRunnableListB |
private ObservableList<java.lang.String> |
stylesheets
A ObservableList of string URLs linking to the stylesheets to use with this scene's
contents.
|
private Scene.TouchGesture |
swipeGesture |
(package private) java.lang.Runnable |
testPulseListener
A listener for pulses, used for testing.
|
private Scene.TargetWrapper |
tmpTargetWrapper |
private int |
touchEventSetId |
private Scene.TouchMap |
touchMap |
private int |
touchPointIndex |
private TouchPoint[] |
touchPoints |
private java.util.Map<java.lang.Integer,EventTarget> |
touchTargets |
private PerformanceTracker |
tracker |
private static java.lang.Object |
trackerMonitor |
private Node |
transientFocusContainer
A node that is temporarily responsible for the FOCUS_NODE
accessibility attribute.
|
private TopMostTraversalEngine |
traversalEngine |
private static java.lang.Object |
USER_DATA_KEY
*
*
*
|
private ObjectProperty<java.lang.String> |
userAgentStylesheet |
private ReadOnlyDoubleWrapper |
width
The width of this
Scene |
private double |
widthSetByUser |
private ReadOnlyObjectWrapper<Window> |
window
The
Window for this Scene |
private ReadOnlyDoubleWrapper |
x
The horizontal location of this
Scene on the Window . |
private ReadOnlyDoubleWrapper |
y
The vertical location of this
Scene on the Window . |
private Scene.TouchGesture |
zoomGesture |
Modifier | Constructor and Description |
---|---|
|
Scene(Parent root)
Creates a Scene for a specific root Node.
|
|
Scene(Parent root,
double width,
double height)
Creates a Scene for a specific root Node with a specific size.
|
|
Scene(Parent root,
double width,
double height,
boolean depthBuffer)
Constructs a scene consisting of a root, with a dimension of width and
height, and specifies whether a depth buffer is created for this scene.
|
|
Scene(Parent root,
double width,
double height,
boolean depthBuffer,
SceneAntialiasing antiAliasing)
Constructs a scene consisting of a root, with a dimension of width and
height, specifies whether a depth buffer is created for this scene and
specifies whether scene anti-aliasing is requested.
|
|
Scene(Parent root,
double width,
double height,
Paint fill)
Creates a Scene for a specific root Node with a specific size and fill.
|
private |
Scene(Parent root,
double width,
double height,
Paint fill,
boolean depthBuffer,
SceneAntialiasing antiAliasing) |
|
Scene(Parent root,
Paint fill)
Creates a Scene for a specific root Node with a fill.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addAccessible(Node node,
Accessible acc) |
<T extends Event> |
addEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Registers an event filter to this scene.
|
<T extends Event> |
addEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Registers an event handler to this scene.
|
(package private) void |
addLight(LightBase light) |
void |
addMnemonic(Mnemonic m)
Registers the specified mnemonic.
|
(package private) static void |
addSnapshotRunnable(java.lang.Runnable runnable) |
(package private) void |
addToDirtyList(Node n)
Add the specified node to this scene's dirty list.
|
EventDispatchChain |
buildEventDispatchChain(EventDispatchChain tail)
Construct an event dispatch chain for this scene.
|
private NodeOrientation |
calcEffectiveNodeOrientation() |
ObjectProperty<Camera> |
cameraProperty() |
private void |
clearDirty()
Clear all dirty bits
|
(package private) void |
clearNodeMnemonics(Node node) |
private SceneEventDispatcher |
createInternalEventDispatcher() |
ObjectProperty<Cursor> |
cursorProperty() |
private void |
disposeAccessibles() |
(package private) void |
doCSSLayoutSyncForSnapshot(Node node) |
private void |
doCSSPass() |
(package private) void |
doLayoutPass() |
(package private) static WritableImage |
doSnapshot(Scene scene,
double x,
double y,
double w,
double h,
Node root,
BaseTransform transform,
boolean depthBuffer,
Paint fill,
Camera camera,
WritableImage wimg) |
private WritableImage |
doSnapshot(WritableImage img)
Implementation method for snapshot
|
ReadOnlyObjectProperty<NodeOrientation> |
effectiveNodeOrientationProperty()
The effective node orientation of a scene resolves the inheritance of
node orientation, returning either left-to-right or right-to-left.
|
ObjectProperty<EventDispatcher> |
eventDispatcherProperty() |
ObjectProperty<Paint> |
fillProperty() |
(package private) void |
focusCleanup() |
private void |
focusIneligible(Node node)
Moves the focus to a reasonble location "near" the given node.
|
private void |
focusInitial()
Moves the focus to a reasonable initial location.
|
ReadOnlyObjectProperty<Node> |
focusOwnerProperty() |
(package private) void |
generateMouseExited(Node removing)
Generates mouse exited event for a node which is going to be removed
and its children, where appropriate.
|
ObservableMap<KeyCombination,java.lang.Runnable> |
getAccelerators()
Gets the list of accelerators for this
Scene . |
(package private) Accessible |
getAccessible() |
SceneAntialiasing |
getAntiAliasing()
Return the defined
SceneAntialiasing for this Scene . |
private boolean |
getAntiAliasingInternal() |
Camera |
getCamera() |
Cursor |
getCursor() |
(package private) Camera |
getEffectiveCamera() |
NodeOrientation |
getEffectiveNodeOrientation() |
EventDispatcher |
getEventDispatcher() |
Paint |
getFill() |
Node |
getFocusOwner() |
double |
getHeight() |
private SceneEventDispatcher |
getInternalEventDispatcher() |
private Scene.KeyHandler |
getKeyHandler() |
ObservableMap<KeyCombination,ObservableList<Mnemonic>> |
getMnemonics()
Gets the list of mnemonics for this
Scene . |
NodeOrientation |
getNodeOrientation() |
EventHandler<? super ContextMenuEvent> |
getOnContextMenuRequested() |
EventHandler<? super MouseEvent> |
getOnDragDetected() |
EventHandler<? super DragEvent> |
getOnDragDone() |
EventHandler<? super DragEvent> |
getOnDragDropped() |
EventHandler<? super DragEvent> |
getOnDragEntered() |
EventHandler<? super DragEvent> |
getOnDragExited() |
EventHandler<? super DragEvent> |
getOnDragOver() |
EventHandler<? super InputMethodEvent> |
getOnInputMethodTextChanged() |
EventHandler<? super KeyEvent> |
getOnKeyPressed() |
EventHandler<? super KeyEvent> |
getOnKeyReleased() |
EventHandler<? super KeyEvent> |
getOnKeyTyped() |
EventHandler<? super MouseEvent> |
getOnMouseClicked() |
EventHandler<? super MouseDragEvent> |
getOnMouseDragEntered() |
EventHandler<? super MouseDragEvent> |
getOnMouseDragExited() |
EventHandler<? super MouseEvent> |
getOnMouseDragged() |
EventHandler<? super MouseDragEvent> |
getOnMouseDragOver() |
EventHandler<? super MouseDragEvent> |
getOnMouseDragReleased() |
EventHandler<? super MouseEvent> |
getOnMouseEntered() |
EventHandler<? super MouseEvent> |
getOnMouseExited() |
EventHandler<? super MouseEvent> |
getOnMouseMoved() |
EventHandler<? super MouseEvent> |
getOnMousePressed() |
EventHandler<? super MouseEvent> |
getOnMouseReleased() |
EventHandler<? super RotateEvent> |
getOnRotate() |
EventHandler<? super RotateEvent> |
getOnRotationFinished() |
EventHandler<? super RotateEvent> |
getOnRotationStarted() |
EventHandler<? super ScrollEvent> |
getOnScroll() |
EventHandler<? super ScrollEvent> |
getOnScrollFinished() |
EventHandler<? super ScrollEvent> |
getOnScrollStarted() |
EventHandler<? super SwipeEvent> |
getOnSwipeDown() |
EventHandler<? super SwipeEvent> |
getOnSwipeLeft() |
EventHandler<? super SwipeEvent> |
getOnSwipeRight() |
EventHandler<? super SwipeEvent> |
getOnSwipeUp() |
EventHandler<? super TouchEvent> |
getOnTouchMoved() |
EventHandler<? super TouchEvent> |
getOnTouchPressed() |
EventHandler<? super TouchEvent> |
getOnTouchReleased() |
EventHandler<? super TouchEvent> |
getOnTouchStationary() |
EventHandler<? super ZoomEvent> |
getOnZoom() |
EventHandler<? super ZoomEvent> |
getOnZoomFinished() |
EventHandler<? super ZoomEvent> |
getOnZoomStarted() |
private static double |
getPreferredHeight(Parent root,
double forcedHeight,
double width) |
private static double |
getPreferredWidth(Parent root,
double forcedWidth,
double height) |
ObservableMap<java.lang.Object,java.lang.Object> |
getProperties()
Returns an observable map of properties on this node for use primarily
by application developers.
|
Parent |
getRoot() |
ObservableList<java.lang.String> |
getStylesheets()
Gets an observable list of string URLs linking to the stylesheets to use
with this scene's contents.
|
java.lang.String |
getUserAgentStylesheet()
Get the URL of the user-agent stylesheet that will be used by this Scene.
|
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. |
double |
getWidth() |
Window |
getWindow() |
double |
getX() |
double |
getY() |
boolean |
hasProperties()
Tests if Scene has properties.
|
ReadOnlyDoubleProperty |
heightProperty() |
private ReadOnlyDoubleWrapper |
heightPropertyImpl() |
void |
impl_disposePeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_enableInputMethodEvents(boolean enable)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
TKScene |
impl_getPeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
TKPulseListener |
impl_getScenePulseListener()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_initPeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_preferredSize()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_processKeyEvent(KeyEvent e)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_processMouseEvent(MouseEvent e)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
static void |
impl_setAllowPGAccess(boolean flag)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
void |
impl_setWindow(Window value)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
private void |
init() |
private void |
init(double width,
double height) |
(package private) void |
initializeInternalEventDispatcher() |
boolean |
isDepthBuffer()
Retrieves the depth buffer attribute for this scene.
|
(package private) boolean |
isDepthBufferInternal() |
private boolean |
isDirty(Scene.DirtyBits dirtyBit)
Test the specified dirty bit
|
private boolean |
isDirtyEmpty()
Test whether the dirty bits are empty
|
(package private) boolean |
isFocusDirty() |
private boolean |
isInScene(double x,
double y) |
(package private) static boolean |
isPGAccessAllowed()
Used for debugging purposes.
|
(package private) boolean |
isQuiescent()
Returns true if this scene is quiescent, i.e.
|
Node |
lookup(java.lang.String selector)
Looks for any node within the scene graph based on the specified CSS selector.
|
(package private) void |
markCameraDirty() |
(package private) void |
markCursorDirty() |
private void |
markDirty(Scene.DirtyBits dirtyBit)
Set the specified dirty bit and mark the peer as dirty
|
ObjectProperty<NodeOrientation> |
nodeOrientationProperty()
Property holding NodeOrientation.
|
ObjectProperty<EventHandler<? super ContextMenuEvent>> |
onContextMenuRequestedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onDragDetectedProperty() |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragDoneProperty()
Defines a function to be called when this @{code Scene} 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
Scene during drag and drop gesture. |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragEnteredProperty()
Defines a function to be called when drag gesture
enters this
Scene . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragExitedProperty()
Defines a function to be called when drag gesture
exits this
Scene . |
ObjectProperty<EventHandler<? super DragEvent>> |
onDragOverProperty()
Defines a function to be called when drag gesture progresses
within this
Scene . |
ObjectProperty<EventHandler<? super InputMethodEvent>> |
onInputMethodTextChangedProperty() |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyPressedProperty() |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyReleasedProperty() |
ObjectProperty<EventHandler<? super KeyEvent>> |
onKeyTypedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseClickedProperty() |
ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragEnteredProperty() |
ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragExitedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseDraggedProperty() |
ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragOverProperty() |
ObjectProperty<EventHandler<? super MouseDragEvent>> |
onMouseDragReleasedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseEnteredProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseExitedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseMovedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMousePressedProperty() |
ObjectProperty<EventHandler<? super MouseEvent>> |
onMouseReleasedProperty() |
ObjectProperty<EventHandler<? super RotateEvent>> |
onRotateProperty() |
ObjectProperty<EventHandler<? super RotateEvent>> |
onRotationFinishedProperty() |
ObjectProperty<EventHandler<? super RotateEvent>> |
onRotationStartedProperty() |
ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollFinishedProperty() |
ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollProperty() |
ObjectProperty<EventHandler<? super ScrollEvent>> |
onScrollStartedProperty() |
ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeDownProperty() |
ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeLeftProperty() |
ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeRightProperty() |
ObjectProperty<EventHandler<? super SwipeEvent>> |
onSwipeUpProperty() |
ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchMovedProperty() |
ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchPressedProperty() |
ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchReleasedProperty() |
ObjectProperty<EventHandler<? super TouchEvent>> |
onTouchStationaryProperty() |
ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoomFinishedProperty() |
ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoomProperty() |
ObjectProperty<EventHandler<? super ZoomEvent>> |
onZoomStartedProperty() |
private void |
parentEffectiveOrientationInvalidated() |
private PickResult |
pick(double x,
double y) |
private void |
pick(Scene.TargetWrapper target,
double x,
double y) |
private void |
preferredSize() |
private void |
processGestureEvent(GestureEvent e,
Scene.TouchGesture gesture) |
private void |
processInputMethodEvent(InputMethodEvent e) |
private void |
processMenuEvent(double x2,
double y2,
double xAbs,
double yAbs,
boolean isKeyboardTrigger) |
private void |
processTouchEvent(TouchEvent e,
TouchPoint[] touchPoints) |
(package private) Accessible |
removeAccessible(Node node) |
<T extends Event> |
removeEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Unregisters a previously registered event filter from this scene.
|
<T extends Event> |
removeEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Unregisters a previously registered event handler from this scene.
|
(package private) void |
removeLight(LightBase light) |
void |
removeMnemonic(Mnemonic m)
Unregisters the specified mnemonic.
|
(package private) void |
requestFocus(Node node) |
(package private) void |
resizeRootOnSceneSizeChange(double newWidth,
double newHeight) |
(package private) void |
resizeRootToPreferredSize(Parent root) |
ObjectProperty<Parent> |
rootProperty() |
private void |
sceneEffectiveOrientationInvalidated() |
void |
setCamera(Camera value) |
void |
setCursor(Cursor value) |
private void |
setDirty(Scene.DirtyBits dirtyBit)
Set the specified dirty bit
|
void |
setEventDispatcher(EventDispatcher value) |
protected <T extends Event> |
setEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Sets the handler to use for this event type.
|
void |
setFill(Paint value) |
(package private) void |
setFocusDirty(boolean value) |
private void |
setHeight(double value) |
(package private) void |
setNeedsRepaint() |
void |
setNodeOrientation(NodeOrientation orientation) |
void |
setOnContextMenuRequested(EventHandler<? super ContextMenuEvent> value) |
void |
setOnDragDetected(EventHandler<? super MouseEvent> value) |
void |
setOnDragDone(EventHandler<? super DragEvent> value) |
void |
setOnDragDropped(EventHandler<? super DragEvent> value) |
void |
setOnDragEntered(EventHandler<? super DragEvent> value) |
void |
setOnDragExited(EventHandler<? super DragEvent> value) |
void |
setOnDragOver(EventHandler<? super DragEvent> value) |
void |
setOnInputMethodTextChanged(EventHandler<? super InputMethodEvent> value) |
void |
setOnKeyPressed(EventHandler<? super KeyEvent> value) |
void |
setOnKeyReleased(EventHandler<? super KeyEvent> value) |
void |
setOnKeyTyped(EventHandler<? super KeyEvent> value) |
void |
setOnMouseClicked(EventHandler<? super MouseEvent> value) |
void |
setOnMouseDragEntered(EventHandler<? super MouseDragEvent> value) |
void |
setOnMouseDragExited(EventHandler<? super MouseDragEvent> value) |
void |
setOnMouseDragged(EventHandler<? super MouseEvent> value) |
void |
setOnMouseDragOver(EventHandler<? super MouseDragEvent> value) |
void |
setOnMouseDragReleased(EventHandler<? super MouseDragEvent> value) |
void |
setOnMouseEntered(EventHandler<? super MouseEvent> value) |
void |
setOnMouseExited(EventHandler<? super MouseEvent> value) |
void |
setOnMouseMoved(EventHandler<? super MouseEvent> value) |
void |
setOnMousePressed(EventHandler<? super MouseEvent> value) |
void |
setOnMouseReleased(EventHandler<? super MouseEvent> value) |
void |
setOnRotate(EventHandler<? super RotateEvent> value) |
void |
setOnRotationFinished(EventHandler<? super RotateEvent> value) |
void |
setOnRotationStarted(EventHandler<? super RotateEvent> value) |
void |
setOnScroll(EventHandler<? super ScrollEvent> value) |
void |
setOnScrollFinished(EventHandler<? super ScrollEvent> value) |
void |
setOnScrollStarted(EventHandler<? super ScrollEvent> value) |
void |
setOnSwipeDown(EventHandler<? super SwipeEvent> value) |
void |
setOnSwipeLeft(EventHandler<? super SwipeEvent> value) |
void |
setOnSwipeRight(EventHandler<? super SwipeEvent> value) |
void |
setOnSwipeUp(EventHandler<? super SwipeEvent> value) |
void |
setOnTouchMoved(EventHandler<? super TouchEvent> value) |
void |
setOnTouchPressed(EventHandler<? super TouchEvent> value) |
void |
setOnTouchReleased(EventHandler<? super TouchEvent> value) |
void |
setOnTouchStationary(EventHandler<? super TouchEvent> value) |
void |
setOnZoom(EventHandler<? super ZoomEvent> value) |
void |
setOnZoomFinished(EventHandler<? super ZoomEvent> value) |
void |
setOnZoomStarted(EventHandler<? super ZoomEvent> value) |
void |
setRoot(Parent value) |
void |
setUserAgentStylesheet(java.lang.String url)
Set the URL of the user-agent stylesheet that will be used by this Scene in place of the
the platform-default user-agent stylesheet.
|
void |
setUserData(java.lang.Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
private void |
setWidth(double value) |
private void |
setWindow(Window value) |
private void |
setX(double value) |
private void |
setY(double value) |
void |
snapshot(Callback<SnapshotResult,java.lang.Void> callback,
WritableImage image)
Takes a snapshot of this scene at the next frame and calls the
specified callback method when the image is ready.
|
WritableImage |
snapshot(WritableImage image)
Takes a snapshot of this scene and returns the rendered image when
it is ready.
|
(package private) Dragboard |
startDragAndDrop(EventTarget source,
TransferMode... transferModes) |
Dragboard |
startDragAndDrop(TransferMode... transferModes)
Confirms a potential drag and drop gesture that is recognized over this
Scene . |
void |
startFullDrag()
Starts a full press-drag-release gesture with this scene as gesture
source.
|
(package private) void |
startFullDrag(EventTarget source) |
private void |
syncLights()
PG Light synchronizer.
|
(package private) Node |
test_pick(double x,
double y)
Note: The only user of this method is in unit test: PickAndContainTest.
|
(package private) boolean |
traverse(Node node,
Direction dir)
Traverses focus from the given node in the given direction.
|
ObjectProperty<java.lang.String> |
userAgentStylesheetProperty() |
ReadOnlyDoubleProperty |
widthProperty() |
private ReadOnlyDoubleWrapper |
widthPropertyImpl() |
ReadOnlyObjectProperty<Window> |
windowProperty() |
private ReadOnlyObjectWrapper<Window> |
windowPropertyImpl() |
ReadOnlyDoubleProperty |
xProperty() |
private ReadOnlyDoubleWrapper |
xPropertyImpl() |
ReadOnlyDoubleProperty |
yProperty() |
private ReadOnlyDoubleWrapper |
yPropertyImpl() |
private double widthSetByUser
private double heightSetByUser
private boolean sizeInitialized
private final boolean depthBuffer
private final SceneAntialiasing antiAliasing
private int dirtyBits
final java.security.AccessControlContext acc
private Camera defaultCamera
private Node transientFocusContainer
private static final int MIN_DIRTY_CAPACITY
private static boolean inSynchronizer
private static boolean inMousePick
private static boolean allowPGAccess
private static int pgAccessCount
private static boolean paused
private static final boolean PLATFORM_DRAG_GESTURE_INITIATION
private Node[] dirtyNodes
Because at initialization time every node in the scene graph is dirty, we have a special state and special code path during initialization that does not involve adding each node to the dirtyNodes list. When dirtyNodes is null, that means this Scene has not yet been synchronized. A good default size is then created for the dirtyNodes list.
We double-buffer the set so that we can add new nodes to the set while processing the existing set. This avoids our having to take a snapshot of the set (e.g., with toArray()) and reduces garbage.
private int dirtyNodesSize
@Deprecated private TKScene impl_peer
Scene.ScenePulseListener scenePulseListener
private ReadOnlyObjectWrapper<Window> window
Window
for this Scene
Scene.DnDGesture dndGesture
Scene.DragGestureListener dragGestureListener
private ReadOnlyDoubleWrapper x
Scene
on the Window
.private ReadOnlyDoubleWrapper y
Scene
on the Window
.private ReadOnlyDoubleWrapper width
Scene
private ReadOnlyDoubleWrapper height
Scene
private Scene.TargetWrapper tmpTargetWrapper
private ObjectProperty<Camera> camera
Scene
.
If camera
is null, a parallel camera is used for rendering.
It is illegal to set a camera that belongs to other Scene
or SubScene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.
private ObjectProperty<Paint> fill
Scene
. Both a null
value meaning 'paint no background' and a Paint
with transparency are supported. The default fill of the Scene is
Color.WHITE
, but it is more commonly the case that the initial
color shown to users is the background fill of the
root node
of the Scene
, as it typically is
stretched to take up all available space in the Scene
. The
root node of the Scene
is given the CSS style class 'root', and
the default user agent stylesheets that ship with JavaFX (presently
Caspian and Modena) apply styling on to this root style class. In the
case of Caspian this does not impact the background fill color of the
root node, but in the case of Modena the default fill is set to be a
light gray color.private ObjectProperty<Parent> root
Node
of the scene graph.
If a Group
is used as the root, the
contents of the scene graph will be clipped by the scene's width and height and
changes to the scene's size (if user resizes the stage) will not alter the
layout of the scene graph. If a resizable node (layout Region
or
Control
) is set as the root, then the root's size will track the
scene's size, causing the contents to be relayed out as necessary.
Scene doesn't accept null root.Parent oldRoot
private static TKPulseListener snapshotPulseListener
private static java.util.List<java.lang.Runnable> snapshotRunnableListA
private static java.util.List<java.lang.Runnable> snapshotRunnableListB
private static java.util.List<java.lang.Runnable> snapshotRunnableList
private ObjectProperty<Cursor> cursor
Scene
.private final ObservableList<java.lang.String> stylesheets
private ObjectProperty<java.lang.String> userAgentStylesheet
private PerformanceTracker tracker
private static final java.lang.Object trackerMonitor
private Scene.MouseHandler mouseHandler
private Scene.ClickGenerator clickGenerator
private Point2D cursorScreenPos
private Point2D cursorScenePos
private final Scene.TouchGesture scrollGesture
private final Scene.TouchGesture zoomGesture
private final Scene.TouchGesture rotateGesture
private final Scene.TouchGesture swipeGesture
private Scene.TouchMap touchMap
private TouchEvent nextTouchEvent
private TouchPoint[] touchPoints
private int touchEventSetId
private int touchPointIndex
private java.util.Map<java.lang.Integer,EventTarget> touchTargets
private Scene.KeyHandler keyHandler
private boolean focusDirty
private TopMostTraversalEngine traversalEngine
private Node oldFocusOwner
private ReadOnlyObjectWrapper<Node> focusOwner
java.lang.Runnable testPulseListener
private java.util.List<LightBase> lights
private ObjectProperty<EventDispatcher> eventDispatcher
EventDispatcher
, the new dispatcher should forward
events to the replaced dispatcher to keep the scene's default event
handling behavior.private SceneEventDispatcher internalEventDispatcher
private ObjectProperty<EventHandler<? super ContextMenuEvent>> onContextMenuRequested
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseClicked
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseDragged
Scene
and then dragged.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseEntered
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseExited
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseMoved
Scene
but no buttons have been pushed.private ObjectProperty<EventHandler<? super MouseEvent>> onMousePressed
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onMouseReleased
Scene
.private ObjectProperty<EventHandler<? super MouseEvent>> onDragDetected
private ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragOver
Scene
.private ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragReleased
Scene
.private ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragEntered
Scene
.private ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragExited
Scene
.private ObjectProperty<EventHandler<? super ScrollEvent>> onScrollStarted
private ObjectProperty<EventHandler<? super ScrollEvent>> onScroll
private ObjectProperty<EventHandler<? super ScrollEvent>> onScrollFinished
private ObjectProperty<EventHandler<? super RotateEvent>> onRotationStarted
private ObjectProperty<EventHandler<? super RotateEvent>> onRotate
private ObjectProperty<EventHandler<? super RotateEvent>> onRotationFinished
private ObjectProperty<EventHandler<? super ZoomEvent>> onZoomStarted
private ObjectProperty<EventHandler<? super ZoomEvent>> onZoom
private ObjectProperty<EventHandler<? super ZoomEvent>> onZoomFinished
private ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeUp
private ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeDown
private ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeLeft
private ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeRight
private ObjectProperty<EventHandler<? super TouchEvent>> onTouchPressed
private ObjectProperty<EventHandler<? super TouchEvent>> onTouchMoved
private ObjectProperty<EventHandler<? super TouchEvent>> onTouchReleased
private ObjectProperty<EventHandler<? super TouchEvent>> onTouchStationary
private ObjectProperty<EventHandler<? super DragEvent>> onDragEntered
private ObjectProperty<EventHandler<? super DragEvent>> onDragExited
private ObjectProperty<EventHandler<? super DragEvent>> onDragOver
private ObjectProperty<EventHandler<? super DragEvent>> onDragDropped
private ObjectProperty<EventHandler<? super DragEvent>> onDragDone
private ObjectProperty<EventHandler<? super KeyEvent>> onKeyPressed
Node
of this
Scene
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.private ObjectProperty<EventHandler<? super KeyEvent>> onKeyReleased
Node
of this
Scene
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.private ObjectProperty<EventHandler<? super KeyEvent>> onKeyTyped
Node
of this
Scene
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.private ObjectProperty<EventHandler<? super InputMethodEvent>> onInputMethodTextChanged
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.private static final java.lang.Object USER_DATA_KEY
private ObservableMap<java.lang.Object,java.lang.Object> properties
private static final NodeOrientation defaultNodeOrientation
private ObjectProperty<NodeOrientation> nodeOrientation
private Scene.EffectiveOrientationProperty effectiveNodeOrientationProperty
private NodeOrientation effectiveNodeOrientation
private java.util.Map<Node,Accessible> accMap
private Accessible accessible
public Scene(Parent root)
root
- The root node of the scene graphjava.lang.NullPointerException
- if root is nullpublic Scene(Parent root, double width, double height)
root
- The root node of the scene graphwidth
- The width of the sceneheight
- The height of the scenejava.lang.NullPointerException
- if root is nullpublic Scene(Parent root, Paint fill)
root
- The parentfill
- The filljava.lang.NullPointerException
- if root is nullpublic Scene(Parent root, double width, double height, Paint fill)
root
- The root node of the scene graphwidth
- The width of the sceneheight
- The height of the scenefill
- The filljava.lang.NullPointerException
- if root is nullpublic Scene(Parent root, double width, double height, boolean depthBuffer)
A scene with only 2D shapes and without any 3D transforms does not need a
depth buffer. A scene containing 3D shapes or 2D shapes with 3D
transforms may use depth buffer support for proper depth sorted
rendering; to avoid depth fighting (also known as Z fighting), disable
depth testing on 2D shapes that have no 3D transforms. See
depthTest
for more information.
root
- The root node of the scene graphwidth
- The width of the sceneheight
- The height of the scenedepthBuffer
- The depth buffer flag
The depthBuffer flag is a conditional feature and its default value is
false. See
ConditionalFeature.SCENE3D
for more information.
java.lang.NullPointerException
- if root is nullNode.setDepthTest(DepthTest)
public Scene(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing)
A scene with only 2D shapes and without any 3D transforms does not need a
depth buffer nor scene anti-aliasing support. A scene containing 3D
shapes or 2D shapes with 3D transforms may use depth buffer support for
proper depth sorted rendering; to avoid depth fighting (also known as Z
fighting), disable depth testing on 2D shapes that have no 3D transforms.
See depthTest
for more information. A
scene with 3D shapes may enable scene anti-aliasing to improve its
rendering quality.
A Scene can be created and modified on any thread until it is attached to a Window
that is showing
(Window.isShowing()
. This does not mean the Scene is thread-safe,
so manipulation from multiple threads at the same time is illegal, may lead to unexpected results and must be avoided.
root
- The root node of the scene graphwidth
- The width of the sceneheight
- The height of the scenedepthBuffer
- The depth buffer flagantiAliasing
- The scene anti-aliasing attribute. A value of
null
is treated as DISABLED.
The depthBuffer and antiAliasing are conditional features. With the
respective default values of: false and SceneAntialiasing.DISABLED
. See
ConditionalFeature.SCENE3D
for more information.
java.lang.NullPointerException
- if root is nullNode.setDepthTest(DepthTest)
private Scene(Parent root, double width, double height, Paint fill, boolean depthBuffer, SceneAntialiasing antiAliasing)
static boolean isPGAccessAllowed()
@Deprecated public static void impl_setAllowPGAccess(boolean flag)
void addToDirtyList(Node n)
private void doCSSPass()
void doLayoutPass()
@Deprecated public TKScene impl_getPeer()
@Deprecated public TKPulseListener impl_getScenePulseListener()
public final SceneAntialiasing getAntiAliasing()
SceneAntialiasing
for this Scene
.
Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
and SceneAntialiasing
for more information.
private boolean getAntiAliasingInternal()
private void setWindow(Window value)
public final Window getWindow()
public final ReadOnlyObjectProperty<Window> windowProperty()
private ReadOnlyObjectWrapper<Window> windowPropertyImpl()
@Deprecated public void impl_setWindow(Window value)
@Deprecated public void impl_initPeer()
@Deprecated public void impl_disposePeer()
private final void setX(double value)
public final double getX()
public final ReadOnlyDoubleProperty xProperty()
private ReadOnlyDoubleWrapper xPropertyImpl()
private final void setY(double value)
public final double getY()
public final ReadOnlyDoubleProperty yProperty()
private ReadOnlyDoubleWrapper yPropertyImpl()
private final void setWidth(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
private ReadOnlyDoubleWrapper widthPropertyImpl()
private final void setHeight(double value)
public final double getHeight()
public final ReadOnlyDoubleProperty heightProperty()
private ReadOnlyDoubleWrapper heightPropertyImpl()
void resizeRootOnSceneSizeChange(double newWidth, double newHeight)
public final void setCamera(Camera value)
public final Camera getCamera()
public final ObjectProperty<Camera> cameraProperty()
Camera getEffectiveCamera()
void markCameraDirty()
void markCursorDirty()
public final void setFill(Paint value)
public final Paint getFill()
public final ObjectProperty<Paint> fillProperty()
public final void setRoot(Parent value)
public final Parent getRoot()
public final ObjectProperty<Parent> rootProperty()
void setNeedsRepaint()
void doCSSLayoutSyncForSnapshot(Node node)
static WritableImage doSnapshot(Scene scene, double x, double y, double w, double h, Node root, BaseTransform transform, boolean depthBuffer, Paint fill, Camera camera, WritableImage wimg)
private WritableImage doSnapshot(WritableImage img)
static void addSnapshotRunnable(java.lang.Runnable runnable)
public WritableImage snapshot(WritableImage image)
Paint
of this scene. The nodes in the scene are then rendered to the image.
The point (0,0) in scene coordinates is mapped to (0,0) in the image.
If the image is smaller than the size of the scene, then the rendering
will be clipped by the image.
When taking a snapshot of a scene that is being animated, either explicitly by the application or implicitly (such as chart animation), the snapshot will be rendered based on the state of the scene graph at the moment the snapshot is taken and will not reflect any subsequent animation changes.
image
- the writable image that will be used to hold the rendered scene.
It may be null in which case a new WritableImage will be constructed.
If the image is non-null, the scene will be rendered into the
existing image.
In this case, the width and height of the image determine the area
that is rendered instead of the width and height of the scene.java.lang.IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.public void snapshot(Callback<SnapshotResult,java.lang.Void> callback, WritableImage image)
Paint
of this scene. The nodes in the scene are then rendered to the image.
The point (0,0) in scene coordinates is mapped to (0,0) in the image.
If the image is smaller than the size of the scene, then the rendering
will be clipped by the image.
This is an asynchronous call, which means that other events or animation might be processed before the scene is rendered. If any such events modify a node in the scene that modification will be reflected in the rendered image (as it will also be reflected in the frame rendered to the Stage).
When taking a snapshot of a scene that is being animated, either explicitly by the application or implicitly (such as chart animation), the snapshot will be rendered based on the state of the scene graph at the moment the snapshot is taken and will not reflect any subsequent animation changes.
callback
- a class whose call method will be called when the image
is ready. The SnapshotResult that is passed into the call method of
the callback will contain the rendered image and the source scene
that was rendered. The callback parameter must not be null.image
- the writable image that will be used to hold the rendered scene.
It may be null in which case a new WritableImage will be constructed.
If the image is non-null, the scene will be rendered into the
existing image.
In this case, the width and height of the image determine the area
that is rendered instead of the width and height of the scene.java.lang.IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.java.lang.NullPointerException
- if the callback parameter is null.public final void setCursor(Cursor value)
public final Cursor getCursor()
public final ObjectProperty<Cursor> cursorProperty()
public Node lookup(java.lang.String selector)
selector
- The css selector to look upNode
in the scene which matches the CSS selector
,
or null
if none is found.public final ObservableList<java.lang.String> getStylesheets()
The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.
package com.example.javafx.app;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MyApp extends Application {
@Override public void start(Stage stage) {
Scene scene = new Scene(new Group());
scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
For additional information about using CSS with the scene graph,
see the CSS Reference Guide.public final ObjectProperty<java.lang.String> userAgentStylesheetProperty()
getUserAgentStylesheet()
,
setUserAgentStylesheet(String)
public final java.lang.String getUserAgentStylesheet()
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
public final void setUserAgentStylesheet(java.lang.String url)
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
url
- The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL
does not have a [scheme:] component, the URL is considered to be the [path] component only.
Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to
the root of the application's classpath.public final boolean isDepthBuffer()
boolean isDepthBufferInternal()
private void init(double width, double height)
private void init()
private void preferredSize()
final void resizeRootToPreferredSize(Parent root)
private static double getPreferredWidth(Parent root, double forcedWidth, double height)
private static double getPreferredHeight(Parent root, double forcedHeight, double width)
@Deprecated public void impl_preferredSize()
@Deprecated public void impl_processMouseEvent(MouseEvent e)
private void processMenuEvent(double x2, double y2, double xAbs, double yAbs, boolean isKeyboardTrigger)
private void processGestureEvent(GestureEvent e, Scene.TouchGesture gesture)
private void processTouchEvent(TouchEvent e, TouchPoint[] touchPoints)
Node test_pick(double x, double y)
private PickResult pick(double x, double y)
private boolean isInScene(double x, double y)
private void pick(Scene.TargetWrapper target, double x, double y)
private Scene.KeyHandler getKeyHandler()
final void setFocusDirty(boolean value)
final boolean isFocusDirty()
boolean traverse(Node node, Direction dir)
private void focusInitial()
private void focusIneligible(Node node)
@Deprecated public void impl_processKeyEvent(KeyEvent e)
void requestFocus(Node node)
public final Node getFocusOwner()
public final ReadOnlyObjectProperty<Node> focusOwnerProperty()
void focusCleanup()
private void processInputMethodEvent(InputMethodEvent e)
@Deprecated public void impl_enableInputMethodEvents(boolean enable)
boolean isQuiescent()
private void markDirty(Scene.DirtyBits dirtyBit)
private void setDirty(Scene.DirtyBits dirtyBit)
private boolean isDirty(Scene.DirtyBits dirtyBit)
private boolean isDirtyEmpty()
private void clearDirty()
final void addLight(LightBase light)
final void removeLight(LightBase light)
private void syncLights()
void generateMouseExited(Node removing)
removing
- Node which is going to be removedpublic final void setEventDispatcher(EventDispatcher value)
public final EventDispatcher getEventDispatcher()
public final ObjectProperty<EventDispatcher> eventDispatcherProperty()
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 registerjava.lang.NullPointerException
- if the event type or handler is nullpublic 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 unregisterjava.lang.NullPointerException
- if the event type or handler is nullpublic 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 registerjava.lang.NullPointerException
- if the event type or filter is nullpublic 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 unregisterjava.lang.NullPointerException
- if the event type or filter is nullprotected 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 unregisterjava.lang.NullPointerException
- if the event type is nullprivate SceneEventDispatcher getInternalEventDispatcher()
final void initializeInternalEventDispatcher()
private SceneEventDispatcher createInternalEventDispatcher()
public void addMnemonic(Mnemonic m)
m
- The mnemonicpublic void removeMnemonic(Mnemonic m)
m
- The mnemonicfinal void clearNodeMnemonics(Node node)
public ObservableMap<KeyCombination,ObservableList<Mnemonic>> getMnemonics()
Scene
.public ObservableMap<KeyCombination,java.lang.Runnable> getAccelerators()
Scene
.public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
buildEventDispatchChain
in interface EventTarget
tail
- the initial chain to build frompublic final void setOnContextMenuRequested(EventHandler<? super ContextMenuEvent> value)
public final EventHandler<? super ContextMenuEvent> getOnContextMenuRequested()
public final ObjectProperty<EventHandler<? super ContextMenuEvent>> onContextMenuRequestedProperty()
public final void setOnMouseClicked(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseClicked()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseClickedProperty()
public final void setOnMouseDragged(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseDragged()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseDraggedProperty()
public final void setOnMouseEntered(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseEntered()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseEnteredProperty()
public final void setOnMouseExited(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseExited()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseExitedProperty()
public final void setOnMouseMoved(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseMoved()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseMovedProperty()
public final void setOnMousePressed(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMousePressed()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMousePressedProperty()
public final void setOnMouseReleased(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnMouseReleased()
public final ObjectProperty<EventHandler<? super MouseEvent>> onMouseReleasedProperty()
public final void setOnDragDetected(EventHandler<? super MouseEvent> value)
public final EventHandler<? super MouseEvent> getOnDragDetected()
public final ObjectProperty<EventHandler<? super MouseEvent>> onDragDetectedProperty()
public final void setOnMouseDragOver(EventHandler<? super MouseDragEvent> value)
public final EventHandler<? super MouseDragEvent> getOnMouseDragOver()
public final ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragOverProperty()
public final void setOnMouseDragReleased(EventHandler<? super MouseDragEvent> value)
public final EventHandler<? super MouseDragEvent> getOnMouseDragReleased()
public final ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragReleasedProperty()
public final void setOnMouseDragEntered(EventHandler<? super MouseDragEvent> value)
public final EventHandler<? super MouseDragEvent> getOnMouseDragEntered()
public final ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragEnteredProperty()
public final void setOnMouseDragExited(EventHandler<? super MouseDragEvent> value)
public final EventHandler<? super MouseDragEvent> getOnMouseDragExited()
public final ObjectProperty<EventHandler<? super MouseDragEvent>> onMouseDragExitedProperty()
public final void setOnScrollStarted(EventHandler<? super ScrollEvent> value)
public final EventHandler<? super ScrollEvent> getOnScrollStarted()
public final ObjectProperty<EventHandler<? super ScrollEvent>> onScrollStartedProperty()
public final void setOnScroll(EventHandler<? super ScrollEvent> value)
public final EventHandler<? super ScrollEvent> getOnScroll()
public final ObjectProperty<EventHandler<? super ScrollEvent>> onScrollProperty()
public final void setOnScrollFinished(EventHandler<? super ScrollEvent> value)
public final EventHandler<? super ScrollEvent> getOnScrollFinished()
public final ObjectProperty<EventHandler<? super ScrollEvent>> onScrollFinishedProperty()
public final void setOnRotationStarted(EventHandler<? super RotateEvent> value)
public final EventHandler<? super RotateEvent> getOnRotationStarted()
public final ObjectProperty<EventHandler<? super RotateEvent>> onRotationStartedProperty()
public final void setOnRotate(EventHandler<? super RotateEvent> value)
public final EventHandler<? super RotateEvent> getOnRotate()
public final ObjectProperty<EventHandler<? super RotateEvent>> onRotateProperty()
public final void setOnRotationFinished(EventHandler<? super RotateEvent> value)
public final EventHandler<? super RotateEvent> getOnRotationFinished()
public final ObjectProperty<EventHandler<? super RotateEvent>> onRotationFinishedProperty()
public final void setOnZoomStarted(EventHandler<? super ZoomEvent> value)
public final EventHandler<? super ZoomEvent> getOnZoomStarted()
public final ObjectProperty<EventHandler<? super ZoomEvent>> onZoomStartedProperty()
public final void setOnZoom(EventHandler<? super ZoomEvent> value)
public final EventHandler<? super ZoomEvent> getOnZoom()
public final ObjectProperty<EventHandler<? super ZoomEvent>> onZoomProperty()
public final void setOnZoomFinished(EventHandler<? super ZoomEvent> value)
public final EventHandler<? super ZoomEvent> getOnZoomFinished()
public final ObjectProperty<EventHandler<? super ZoomEvent>> onZoomFinishedProperty()
public final void setOnSwipeUp(EventHandler<? super SwipeEvent> value)
public final EventHandler<? super SwipeEvent> getOnSwipeUp()
public final ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeUpProperty()
public final void setOnSwipeDown(EventHandler<? super SwipeEvent> value)
public final EventHandler<? super SwipeEvent> getOnSwipeDown()
public final ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeDownProperty()
public final void setOnSwipeLeft(EventHandler<? super SwipeEvent> value)
public final EventHandler<? super SwipeEvent> getOnSwipeLeft()
public final ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeLeftProperty()
public final void setOnSwipeRight(EventHandler<? super SwipeEvent> value)
public final EventHandler<? super SwipeEvent> getOnSwipeRight()
public final ObjectProperty<EventHandler<? super SwipeEvent>> onSwipeRightProperty()
public final void setOnTouchPressed(EventHandler<? super TouchEvent> value)
public final EventHandler<? super TouchEvent> getOnTouchPressed()
public final ObjectProperty<EventHandler<? super TouchEvent>> onTouchPressedProperty()
public final void setOnTouchMoved(EventHandler<? super TouchEvent> value)
public final EventHandler<? super TouchEvent> getOnTouchMoved()
public final ObjectProperty<EventHandler<? super TouchEvent>> onTouchMovedProperty()
public final void setOnTouchReleased(EventHandler<? super TouchEvent> value)
public final EventHandler<? super TouchEvent> getOnTouchReleased()
public final ObjectProperty<EventHandler<? super TouchEvent>> onTouchReleasedProperty()
public final void setOnTouchStationary(EventHandler<? super TouchEvent> value)
public final EventHandler<? super TouchEvent> getOnTouchStationary()
public final ObjectProperty<EventHandler<? super TouchEvent>> onTouchStationaryProperty()
public final void setOnDragEntered(EventHandler<? super DragEvent> value)
public final EventHandler<? super DragEvent> getOnDragEntered()
public final ObjectProperty<EventHandler<? super DragEvent>> onDragEnteredProperty()
Scene
.public final void setOnDragExited(EventHandler<? super DragEvent> value)
public final EventHandler<? super DragEvent> getOnDragExited()
public final ObjectProperty<EventHandler<? super DragEvent>> onDragExitedProperty()
Scene
.public final void setOnDragOver(EventHandler<? super DragEvent> value)
public final EventHandler<? super DragEvent> getOnDragOver()
public final ObjectProperty<EventHandler<? super DragEvent>> onDragOverProperty()
Scene
.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)
public final EventHandler<? super DragEvent> getOnDragDone()
public final ObjectProperty<EventHandler<? super DragEvent>> onDragDoneProperty()
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.
Positional data for the DragEvent
is invalid. Valid positional
data for the DragEvent
is presented in the onDragDropped
event handler.public Dragboard startDragAndDrop(TransferMode... transferModes)
Scene
.
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 Scene
's data on the
Dragboard
also identifies this Scene
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 Scene
's data onjava.lang.IllegalStateException
- if drag and drop cannot be started at this
moment (it's called outside of DRAG_DETECTED
event handling).DragEvent
public void startFullDrag()
DRAG_DETECTED
mouse
event handler. More detail about dragging gestures can be found
in the overview of MouseEvent
and MouseDragEvent
.java.lang.IllegalStateException
- if the full press-drag-release gesture
cannot be started at this moment (it's called outside of
DRAG_DETECTED
event handling).MouseEvent
,
MouseDragEvent
Dragboard startDragAndDrop(EventTarget source, TransferMode... transferModes)
void startFullDrag(EventTarget source)
public final void setOnKeyPressed(EventHandler<? super KeyEvent> value)
public final EventHandler<? super KeyEvent> getOnKeyPressed()
public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyPressedProperty()
public final void setOnKeyReleased(EventHandler<? super KeyEvent> value)
public final EventHandler<? super KeyEvent> getOnKeyReleased()
public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyReleasedProperty()
public final void setOnKeyTyped(EventHandler<? super KeyEvent> value)
public final EventHandler<? super KeyEvent> getOnKeyTyped()
public final ObjectProperty<EventHandler<? super KeyEvent>> onKeyTypedProperty()
public final void setOnInputMethodTextChanged(EventHandler<? super InputMethodEvent> value)
public final EventHandler<? super InputMethodEvent> getOnInputMethodTextChanged()
public final ObjectProperty<EventHandler<? super InputMethodEvent>> onInputMethodTextChangedProperty()
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 void setNodeOrientation(NodeOrientation orientation)
public final NodeOrientation getNodeOrientation()
public final ObjectProperty<NodeOrientation> nodeOrientationProperty()
Node orientation describes the flow of visual data within a node. In the English speaking world, visual data normally flows from left-to-right. In an Arabic or Hebrew world, visual data flows from right-to-left. This is consistent with the reading order of text in both worlds. The default value is left-to-right.
public final NodeOrientation getEffectiveNodeOrientation()
public final ReadOnlyObjectProperty<NodeOrientation> effectiveNodeOrientationProperty()
private void parentEffectiveOrientationInvalidated()
private void sceneEffectiveOrientationInvalidated()
private NodeOrientation calcEffectiveNodeOrientation()
Accessible removeAccessible(Node node)
void addAccessible(Node node, Accessible acc)
private void disposeAccessibles()
Accessible getAccessible()