- All Implemented Interfaces:
javafx.css.Styleable,javafx.event.EventTarget,javafx.scene.control.Skinnable
Stage. It's a translucent (glass) pane
that can hold arbitrary content as well as animate its appearance.
When displayProperty() value is changed the modal pane modifies own
Node.viewOrderProperty() value accordingly, thus moving itself on top of the
parent container or vise versa. You can change the target view order value via the
constructor param. This also means that one must not change the modal pane
Node.viewOrderProperty() property manually.
Example:
ModalPane modalPane = new ModalPane();
Label content = new Label("Content");
content.setSize(450, 450);
Button openBtn = new Button("Open");
openBtn.setOnAction(evt -> modalPane.show(content));
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ObjectProperty<javafx.geometry.Pos>Specifies the alignment of the content node.javafx.beans.property.ObjectProperty<javafx.scene.Node>Specifies the content node to display inside the modal pane.javafx.beans.property.BooleanPropertyIndicates whether the modal pane is set to be on top or not.javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> The factory that provides a transition to be played on content appearance, i.e.javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> The factory that provides a transition to be played on content disappearance, i.e.javafx.beans.property.BooleanPropertySpecifies whether the content should be treated as persistent or not.Properties inherited from class javafx.scene.control.Control
contextMenu, skin, tooltipProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from 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
FieldsModifier and TypeFieldDescriptionprotected final javafx.beans.property.ObjectProperty<javafx.geometry.Pos>protected final javafx.beans.property.ObjectProperty<javafx.scene.Node>static final javafx.util.DurationThe default animation duration that is applied to the modal content when it enters the user view.static final javafx.util.DurationThe default animation duration that is applied to the modal content when it leaves the user view.protected final javafx.beans.property.BooleanPropertyprotected final javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> protected final javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> protected final javafx.beans.property.BooleanPropertystatic final intThe default value that is set to the modal pane when it must be below of other nodes.static final intThe default value that is set to the modal pane when it must be on top of other nodes.Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavafx.beans.property.ObjectProperty<javafx.geometry.Pos>Specifies the alignment of the content node.javafx.beans.property.ObjectProperty<javafx.scene.Node>Specifies the content node to display inside the modal pane.protected javafx.scene.control.Skin<?>javafx.beans.property.BooleanPropertyIndicates whether the modal pane is set to be on top or not.javafx.geometry.PosGets the value of the property alignment.javafx.scene.NodeGets the value of the property content.Function<javafx.scene.Node,javafx.animation.Animation> Gets the value of the property inTransitionFactory.Function<javafx.scene.Node,javafx.animation.Animation> Gets the value of the property outTransitionFactory.booleanGets the value of the property persistent.intReturns the value ofNode.viewOrderProperty()to be set in order to display the ModalPane on top of its parent container.voidhide()Seehide(boolean).voidhide(boolean clear) A convenience method for clearing the content of the modal pane content and triggering its display state at the same time.javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> The factory that provides a transition to be played on content appearance, i.e.booleanGets the value of the property display.javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> The factory that provides a transition to be played on content disappearance, i.e.javafx.beans.property.BooleanPropertySpecifies whether the content should be treated as persistent or not.voidsetAlignment(javafx.geometry.Pos alignment) Sets the value of the property alignment.voidsetContent(javafx.scene.Node node) Sets the value of the property content.voidsetDisplay(boolean display) Sets the value of the property display.voidsetInTransitionFactory(Function<javafx.scene.Node, javafx.animation.Animation> inTransitionFactory) Sets the value of the property inTransitionFactory.voidsetOutTransitionFactory(Function<javafx.scene.Node, javafx.animation.Animation> outTransitionFactory) Sets the value of the property outTransitionFactory.voidsetPersistent(boolean persistent) Sets the value of the property persistent.voidshow(javafx.scene.Node node) A convenience method for setting the content of the modal pane content and triggering its display state at the same time.voidusePredefinedTransitionFactories(@Nullable javafx.geometry.Side side) voidusePredefinedTransitionFactories(@Nullable javafx.geometry.Side side, @Nullable javafx.util.Duration inDuration, @Nullable javafx.util.Duration outDuration) Sets the predefined factory for bothinTransitionFactoryProperty()andoutTransitionFactoryProperty()based on content position.Methods inherited from class javafx.scene.control.Control
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipPropertyMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods inherited from 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, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, 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, 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, lookupAll, managedProperty, 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, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, 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, visiblePropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
content
public javafx.beans.property.ObjectProperty<javafx.scene.Node> contentPropertySpecifies the content node to display inside the modal pane.- See Also:
-
display
public javafx.beans.property.BooleanProperty displayPropertyIndicates whether the modal pane is set to be on top or not. When changed, theNode.viewOrderProperty()value will be modified accordingly. See thegetTopViewOrder().- See Also:
-
alignment
public javafx.beans.property.ObjectProperty<javafx.geometry.Pos> alignmentPropertySpecifies the alignment of the content node.- See Also:
-
inTransitionFactory
public javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> inTransitionFactoryPropertyThe factory that provides a transition to be played on content appearance, i.e. whendisplayProperty()is set to 'true'. -
outTransitionFactory
public javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> outTransitionFactoryPropertyThe factory that provides a transition to be played on content disappearance, i.e. whendisplayProperty()is set to 'false'. -
persistent
public javafx.beans.property.BooleanProperty persistentPropertySpecifies whether the content should be treated as persistent or not.By default, the modal pane exits when the ESC button is pressed or when the mouse is clicked outside the content area. This property prevents this behavior and plays a bouncing animation instead.
- See Also:
-
-
Field Details
-
Z_FRONT
public static final int Z_FRONTThe default value that is set to the modal pane when it must be on top of other nodes.- See Also:
-
Z_BACK
public static final int Z_BACKThe default value that is set to the modal pane when it must be below of other nodes.- See Also:
-
DEFAULT_DURATION_IN
public static final javafx.util.Duration DEFAULT_DURATION_INThe default animation duration that is applied to the modal content when it enters the user view. -
DEFAULT_DURATION_OUT
public static final javafx.util.Duration DEFAULT_DURATION_OUTThe default animation duration that is applied to the modal content when it leaves the user view. -
protected final javafx.beans.property.ObjectProperty<javafx.scene.Node> content
-
display
protected final javafx.beans.property.BooleanProperty display -
alignment
protected final javafx.beans.property.ObjectProperty<javafx.geometry.Pos> alignment -
inTransitionFactory
protected final javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> inTransitionFactory -
outTransitionFactory
protected final javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> outTransitionFactory -
persistent
protected final javafx.beans.property.BooleanProperty persistent
-
-
Constructor Details
-
ModalPane
public ModalPane()Creates a new modal pane with the defaulttopViewOrderproperty value. -
ModalPane
public ModalPane(int topViewOrder) Creates a new modal pane with the specifiedtopViewOrderproperty.- Parameters:
topViewOrder- TheNode.viewOrderProperty()value to be set in order to display the ModalPane on top of the parent container.
-
-
Method Details
-
createDefaultSkin
protected javafx.scene.control.Skin<?> createDefaultSkin()- Overrides:
createDefaultSkinin classjavafx.scene.control.Control
-
getTopViewOrder
public int getTopViewOrder()Returns the value ofNode.viewOrderProperty()to be set in order to display the ModalPane on top of its parent container. This is a constructor parameter that cannot be changed after the ModalPane has been instantiated. -
contentProperty
public javafx.beans.property.ObjectProperty<javafx.scene.Node> contentProperty()Specifies the content node to display inside the modal pane.- See Also:
-
getContent
public javafx.scene.Node getContent()Gets the value of the property content.- Property description:
- Specifies the content node to display inside the modal pane.
-
setContent
public void setContent(javafx.scene.Node node) Sets the value of the property content.- Property description:
- Specifies the content node to display inside the modal pane.
-
displayProperty
public javafx.beans.property.BooleanProperty displayProperty()Indicates whether the modal pane is set to be on top or not. When changed, theNode.viewOrderProperty()value will be modified accordingly. See thegetTopViewOrder().- See Also:
-
isDisplay
public boolean isDisplay()Gets the value of the property display.- Property description:
- Indicates whether the modal pane is set to be on top or not.
When changed, the
Node.viewOrderProperty()value will be modified accordingly. See thegetTopViewOrder().
-
setDisplay
public void setDisplay(boolean display) Sets the value of the property display.- Property description:
- Indicates whether the modal pane is set to be on top or not.
When changed, the
Node.viewOrderProperty()value will be modified accordingly. See thegetTopViewOrder().
-
alignmentProperty
public javafx.beans.property.ObjectProperty<javafx.geometry.Pos> alignmentProperty()Specifies the alignment of the content node.- See Also:
-
getAlignment
public javafx.geometry.Pos getAlignment()Gets the value of the property alignment.- Property description:
- Specifies the alignment of the content node.
-
setAlignment
public void setAlignment(javafx.geometry.Pos alignment) Sets the value of the property alignment.- Property description:
- Specifies the alignment of the content node.
-
inTransitionFactoryProperty
public javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> inTransitionFactoryProperty()The factory that provides a transition to be played on content appearance, i.e. whendisplayProperty()is set to 'true'. -
getInTransitionFactory
Gets the value of the property inTransitionFactory.- Property description:
- The factory that provides a transition to be played on content appearance,
i.e. when
displayProperty()is set to 'true'.
-
setInTransitionFactory
public void setInTransitionFactory(Function<javafx.scene.Node, javafx.animation.Animation> inTransitionFactory) Sets the value of the property inTransitionFactory.- Property description:
- The factory that provides a transition to be played on content appearance,
i.e. when
displayProperty()is set to 'true'.
-
outTransitionFactoryProperty
public javafx.beans.property.ObjectProperty<Function<javafx.scene.Node,javafx.animation.Animation>> outTransitionFactoryProperty()The factory that provides a transition to be played on content disappearance, i.e. whendisplayProperty()is set to 'false'. -
getOutTransitionFactory
Gets the value of the property outTransitionFactory.- Property description:
- The factory that provides a transition to be played on content disappearance,
i.e. when
displayProperty()is set to 'false'.
-
setOutTransitionFactory
public void setOutTransitionFactory(Function<javafx.scene.Node, javafx.animation.Animation> outTransitionFactory) Sets the value of the property outTransitionFactory.- Property description:
- The factory that provides a transition to be played on content disappearance,
i.e. when
displayProperty()is set to 'false'.
-
persistentProperty
public javafx.beans.property.BooleanProperty persistentProperty()Specifies whether the content should be treated as persistent or not.By default, the modal pane exits when the ESC button is pressed or when the mouse is clicked outside the content area. This property prevents this behavior and plays a bouncing animation instead.
- See Also:
-
getPersistent
public boolean getPersistent()Gets the value of the property persistent.- Property description:
- Specifies whether the content should be treated as persistent or not.
By default, the modal pane exits when the ESC button is pressed or when the mouse is clicked outside the content area. This property prevents this behavior and plays a bouncing animation instead.
-
setPersistent
public void setPersistent(boolean persistent) Sets the value of the property persistent.- Property description:
- Specifies whether the content should be treated as persistent or not.
By default, the modal pane exits when the ESC button is pressed or when the mouse is clicked outside the content area. This property prevents this behavior and plays a bouncing animation instead.
-
show
public void show(javafx.scene.Node node) A convenience method for setting the content of the modal pane content and triggering its display state at the same time. -
hide
public void hide(boolean clear) A convenience method for clearing the content of the modal pane content and triggering its display state at the same time. -
hide
public void hide()Seehide(boolean). -
usePredefinedTransitionFactories
public void usePredefinedTransitionFactories(@Nullable @Nullable javafx.geometry.Side side) -
usePredefinedTransitionFactories
public void usePredefinedTransitionFactories(@Nullable @Nullable javafx.geometry.Side side, @Nullable @Nullable javafx.util.Duration inDuration, @Nullable @Nullable javafx.util.Duration outDuration) Sets the predefined factory for bothinTransitionFactoryProperty()andoutTransitionFactoryProperty()based on content position.
-