Class SubScene
- All Implemented Interfaces:
Styleable
,EventTarget
SubScene
class is the container for content in a scene graph.
SubScene
provides separation of different parts of a scene, each
of which can be rendered with a different camera, depth buffer, or scene
anti-aliasing. A SubScene
is embedded into the main scene or another
sub-scene.
An application may request depth buffer support or scene anti-aliasing
support at the creation of a SubScene
. A sub-scene with only 2D
shapes and without any 3D transforms does not need a depth buffer nor scene
anti-aliasing support. A sub-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 sub-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.
Possible use cases are:
- Mixing 2D and 3D content
- Overlay for UI controls
- Underlay for background
- Heads-up display
A default headlight will be added to a SubScene
that contains one or more
Shape3D
nodes, but no light nodes. This light source is a
Color.WHITE
PointLight
placed at the camera position.
- Since:
- JavaFX 8.0
-
Property Summary
TypePropertyDescriptionfinal ObjectProperty
<Camera> Specifies the type of camera use for rendering thisSubScene
.final ObjectProperty
<Paint> Defines the background fill of thisSubScene
.final DoubleProperty
Defines the height of thisSubScene
final ObjectProperty
<Parent> Defines the rootNode
of theSubScene
scene graph.final ObjectProperty
<String> Gets the userAgentStylesheet property.final DoubleProperty
Defines the width of thisSubScene
Properties declared in class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Field Summary
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
ConstructorDescriptionCreates aSubScene
for a specific root Node with a specific size.SubScene
(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing) Constructs aSubScene
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. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectProperty
<Camera> Specifies the type of camera use for rendering thisSubScene
.final ObjectProperty
<Paint> Defines the background fill of thisSubScene
.final SceneAntialiasing
Return the definedSceneAntialiasing
for thisSubScene
.final Camera
Gets the value of thecamera
property.final Paint
getFill()
Gets the value of thefill
property.final double
Gets the value of theheight
property.final Parent
getRoot()
Gets the value of theroot
property.final String
Get the URL of the user-agent stylesheet that will be used by this SubScene.final double
getWidth()
Gets the value of thewidth
property.final DoubleProperty
Defines the height of thisSubScene
final boolean
Retrieves the depth buffer attribute for thisSubScene
.final ObjectProperty
<Parent> Defines the rootNode
of theSubScene
scene graph.final void
Sets the value of thecamera
property.final void
Sets the value of thefill
property.final void
setHeight
(double value) Sets the value of theheight
property.final void
Sets the value of theroot
property.final void
Set the URL of the user-agent stylesheet that will be used by this SubScene in place of the the platform-default user-agent stylesheet.final void
setWidth
(double value) Sets the value of thewidth
property.final ObjectProperty
<String> Gets the userAgentStylesheet property.final DoubleProperty
Defines the width of thisSubScene
Methods declared in class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBaselineOffset, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, maxHeight, maxWidth, minHeight, minWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, prefHeight, prefWidth, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods declared in interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
root
Defines the rootNode
of theSubScene
scene graph. If aGroup
is used as the root, the contents of the scene graph will be clipped by theSubScene
's width and height.SubScene
doesn't accept null root.- See Also:
-
camera
Specifies the type of camera use for rendering thisSubScene
. Ifcamera
is null, a parallel camera is used for rendering. It is illegal to set a camera that belongs to otherScene
orSubScene
.Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.- Default value:
- null
- See Also:
-
width
Defines the width of thisSubScene
- Default value:
- 0.0
- See Also:
-
height
Defines the height of thisSubScene
- Default value:
- 0.0
- See Also:
-
fill
Defines the background fill of thisSubScene
. Both anull
value meaning paint no background and aPaint
with transparency are supported. The default value is null.- Default value:
- null
- See Also:
-
userAgentStylesheet
Gets the userAgentStylesheet property.- Since:
- JavaFX 8u20
- See Also:
-
-
Constructor Details
-
SubScene
Creates aSubScene
for a specific root Node with a specific size.- Parameters:
root
- The root node of the scene graphwidth
- The width of the sub-sceneheight
- The height of the sub-scene- Throws:
NullPointerException
- if root is null
-
SubScene
public SubScene(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing) Constructs aSubScene
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.A sub-scene with only 2D shapes and without any 3D transforms does not need a depth buffer nor scene anti-aliasing support. A sub-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 sub-scene with 3D shapes may enable scene anti-aliasing to improve its rendering quality.- Parameters:
root
- The root node of the scene graphwidth
- The width of the sub-sceneheight
- The height of the sub-scenedepthBuffer
- The depth buffer flagantiAliasing
- The sub-scene anti-aliasing attribute. A value ofnull
is treated as DISABLED.The depthBuffer and antiAliasing flags are conditional features. With the respective default values of: false and
SceneAntialiasing.DISABLED
. SeeConditionalFeature.SCENE3D
for more information.- Throws:
NullPointerException
- if root is null- See Also:
-
-
Method Details
-
getAntiAliasing
Return the definedSceneAntialiasing
for thisSubScene
.Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
andSceneAntialiasing
for more information.- Returns:
- the SceneAntialiasing for this sub-scene
- Since:
- JavaFX 8.0
-
isDepthBuffer
public final boolean isDepthBuffer()Retrieves the depth buffer attribute for thisSubScene
.- Returns:
- the depth buffer attribute.
-
setRoot
Sets the value of theroot
property.- Property description:
- Defines the root
Node
of theSubScene
scene graph. If aGroup
is used as the root, the contents of the scene graph will be clipped by theSubScene
's width and height.SubScene
doesn't accept null root. - Parameters:
value
- the value for theroot
property- See Also:
-
getRoot
Gets the value of theroot
property.- Property description:
- Defines the root
Node
of theSubScene
scene graph. If aGroup
is used as the root, the contents of the scene graph will be clipped by theSubScene
's width and height.SubScene
doesn't accept null root. - Returns:
- the value of the
root
property - See Also:
-
rootProperty
Defines the rootNode
of theSubScene
scene graph. If aGroup
is used as the root, the contents of the scene graph will be clipped by theSubScene
's width and height.SubScene
doesn't accept null root.- Returns:
- the
root
property - See Also:
-
setCamera
Sets the value of thecamera
property.- Property description:
- Specifies the type of camera use for rendering this
SubScene
. Ifcamera
is null, a parallel camera is used for rendering. It is illegal to set a camera that belongs to otherScene
orSubScene
.Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information. - Default value:
- null
- Parameters:
value
- the value for thecamera
property- See Also:
-
getCamera
Gets the value of thecamera
property.- Property description:
- Specifies the type of camera use for rendering this
SubScene
. Ifcamera
is null, a parallel camera is used for rendering. It is illegal to set a camera that belongs to otherScene
orSubScene
.Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information. - Default value:
- null
- Returns:
- the value of the
camera
property - See Also:
-
cameraProperty
Specifies the type of camera use for rendering thisSubScene
. Ifcamera
is null, a parallel camera is used for rendering. It is illegal to set a camera that belongs to otherScene
orSubScene
.Note: this is a conditional feature. See
ConditionalFeature.SCENE3D
for more information.- Default value:
- null
- Returns:
- the
camera
property - See Also:
-
setWidth
public final void setWidth(double value) Sets the value of thewidth
property.- Property description:
- Defines the width of this
SubScene
- Default value:
- 0.0
- Parameters:
value
- the value for thewidth
property- See Also:
-
getWidth
public final double getWidth()Gets the value of thewidth
property.- Property description:
- Defines the width of this
SubScene
- Default value:
- 0.0
- Returns:
- the value of the
width
property - See Also:
-
widthProperty
Defines the width of thisSubScene
- Default value:
- 0.0
- Returns:
- the
width
property - See Also:
-
setHeight
public final void setHeight(double value) Sets the value of theheight
property.- Property description:
- Defines the height of this
SubScene
- Default value:
- 0.0
- Parameters:
value
- the value for theheight
property- See Also:
-
getHeight
public final double getHeight()Gets the value of theheight
property.- Property description:
- Defines the height of this
SubScene
- Default value:
- 0.0
- Returns:
- the value of the
height
property - See Also:
-
heightProperty
Defines the height of thisSubScene
- Default value:
- 0.0
- Returns:
- the
height
property - See Also:
-
setFill
Sets the value of thefill
property.- Property description:
- Defines the background fill of this
SubScene
. Both anull
value meaning paint no background and aPaint
with transparency are supported. The default value is null. - Default value:
- null
- Parameters:
value
- the value for thefill
property- See Also:
-
getFill
Gets the value of thefill
property.- Property description:
- Defines the background fill of this
SubScene
. Both anull
value meaning paint no background and aPaint
with transparency are supported. The default value is null. - Default value:
- null
- Returns:
- the value of the
fill
property - See Also:
-
fillProperty
Defines the background fill of thisSubScene
. Both anull
value meaning paint no background and aPaint
with transparency are supported. The default value is null.- Default value:
- null
- Returns:
- the
fill
property - See Also:
-
userAgentStylesheetProperty
Gets the userAgentStylesheet property.- Returns:
- the userAgentStylesheet property
- Since:
- JavaFX 8u20
- See Also:
-
getUserAgentStylesheet
Get the URL of the user-agent stylesheet that will be used by this SubScene. If the URL has not been set, the platform-default user-agent stylesheet will be used.For additional information about using CSS with the scene graph, see the CSS Reference Guide.
- Returns:
- The URL of the user-agent stylesheet that will be used by this SubScene, or null if has not been set.
- Since:
- JavaFX 8u20
-
setUserAgentStylesheet
Set the URL of the user-agent stylesheet that will be used by this SubScene in place of the the platform-default user-agent stylesheet. If the URL does not resolve to a valid location, the platform-default user-agent stylesheet will be used.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.
The RFC 2397 "data" scheme for URLs is supported in addition to the protocol handlers that are registered for the application. If a URL uses the "data" scheme and the MIME type is either empty, "text/plain", or "text/css", the payload will be interpreted as a CSS file. If the MIME type is "application/octet-stream", the payload will be interpreted as a binary CSS file (see
Stylesheet.convertToBinary(File, File)
).For additional information about using CSS with the scene graph, see the CSS Reference Guide.
- Parameters:
url
- the URL of the user-agent stylesheet- Since:
- JavaFX 8u20
-