- All Implemented Interfaces:
javafx.css.Styleable,javafx.event.EventTarget
ModalPane
dialog content. It includes the close button out-of-the-box and allows for the
addition of arbitrary children.
The ModalBox is derived from the AnchorPane, so it inherits the same API.
Just be sure that you haven't removed the close button while using it.
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.BooleanPropertySpecifies whether to remove (clear) the ModalPane content after it's closed.javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> The property representing the user specified close handler.Properties 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.BooleanPropertyprotected final javafx.scene.layout.StackPaneprotected final javafx.scene.layout.StackPaneprotected @Nullable ModalPaneprotected final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> protected final @Nullable StringFields 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
ConstructorsConstructorDescriptionModalBox()Creates a ModalBox layout.Creates a ModalBox layout with the given children and binds the close handler to a ModalPane.Creates a ModalBox layout with the given children and binds the close handler to a ModalPane via CSS selector.ModalBox(javafx.scene.Node... children) Creates a ModalBox layout with the given children. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContent(javafx.scene.Node node) Adds (prepends) specified node to the ModalBox before the close button.javafx.beans.property.BooleanPropertySpecifies whether to remove (clear) the ModalPane content after it's closed.voidclose()Manually closes the ModalBox in case one needs to use their own close button.protected voidjavafx.event.EventHandler<? super javafx.event.Event> Gets the value of theonCloseproperty.protected voidbooleanGets the value of theclearOnCloseproperty.javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> The property representing the user specified close handler.voidsetClearOnClose(boolean clearOnClose) Sets the value of theclearOnCloseproperty.protected voidvoidsetOnClose(javafx.event.EventHandler<? super javafx.event.Event> onClose) Sets the value of theonCloseproperty.Methods inherited from class javafx.scene.layout.AnchorPane
clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBottomAnchor, getLeftAnchor, getRightAnchor, getTopAnchor, layoutChildren, setBottomAnchor, setLeftAnchor, setRightAnchor, setTopAnchorMethods inherited from class javafx.scene.layout.Pane
getChildrenMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getClassCssMetaData, getCssMetaData, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, 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
getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, 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, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, 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, 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
-
onClose
public javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> onClosePropertyThe property representing the user specified close handler.Note that if you have also specified the ModalPane instance or CSS selector, this handler will be executed after the default close handler. Therefore, you can use it to perform arbitrary actions on dialog close.
- See Also:
-
clearOnClose
public javafx.beans.property.BooleanProperty clearOnClosePropertySpecifies whether to remove (clear) the ModalPane content after it's closed.- See Also:
-
-
Field Details
-
closeButton
protected final javafx.scene.layout.StackPane closeButton -
closeButtonIcon
protected final javafx.scene.layout.StackPane closeButtonIcon -
selector
-
modalPane
-
onClose
protected final javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> onClose -
clearOnClose
protected final javafx.beans.property.BooleanProperty clearOnClose
-
-
Constructor Details
-
ModalBox
public ModalBox()Creates a ModalBox layout. -
ModalBox
public ModalBox(javafx.scene.Node... children) Creates a ModalBox layout with the given children.- Parameters:
children- The initial set of children for this pane.
-
ModalBox
Creates a ModalBox layout with the given children and binds the close handler to a ModalPane via CSS selector. When user clicks on the close button, it performs a ModalPane lookup via the specified selector and calls theModalPane.hide()method automatically.- Parameters:
selector- The ModalPane pane CSS selector.children- The initial set of children for this pane.
-
ModalBox
Creates a ModalBox layout with the given children and binds the close handler to a ModalPane. When user clicks on the close button, it calls theModalPane.hide()method automatically.- Parameters:
modalPane- The ModalPane pane CSS selector.children- The initial set of children for this pane.
-
-
Method Details
-
addContent
public void addContent(javafx.scene.Node node) Adds (prepends) specified node to the ModalBox before the close button.Otherwise, if the added node takes up the full size of the ModalBox and
Node.isMouseTransparent()is false, then the close button will not receive mouse events and therefore will not be clickable.- Parameters:
node- The node to be added.
-
close
public void close()Manually closes the ModalBox in case one needs to use their own close button. -
createLayout
protected void createLayout() -
setCloseButtonPosition
protected void setCloseButtonPosition() -
handleClose
protected void handleClose() -
onCloseProperty
public javafx.beans.property.ObjectProperty<javafx.event.EventHandler<? super javafx.event.Event>> onCloseProperty()The property representing the user specified close handler.Note that if you have also specified the ModalPane instance or CSS selector, this handler will be executed after the default close handler. Therefore, you can use it to perform arbitrary actions on dialog close.
- Returns:
- the
onCloseproperty - See Also:
-
getOnClose
public javafx.event.EventHandler<? super javafx.event.Event> getOnClose()Gets the value of theonCloseproperty.- Property description:
- The property representing the user specified close handler.
Note that if you have also specified the ModalPane instance or CSS selector, this handler will be executed after the default close handler. Therefore, you can use it to perform arbitrary actions on dialog close.
- Returns:
- the value of the
onCloseproperty - See Also:
-
setOnClose
public void setOnClose(javafx.event.EventHandler<? super javafx.event.Event> onClose) Sets the value of theonCloseproperty.- Property description:
- The property representing the user specified close handler.
Note that if you have also specified the ModalPane instance or CSS selector, this handler will be executed after the default close handler. Therefore, you can use it to perform arbitrary actions on dialog close.
- Parameters:
onClose- the value for theonCloseproperty- See Also:
-
clearOnCloseProperty
public javafx.beans.property.BooleanProperty clearOnCloseProperty()Specifies whether to remove (clear) the ModalPane content after it's closed.- Returns:
- the
clearOnCloseproperty - See Also:
-
isClearOnClose
public boolean isClearOnClose()Gets the value of theclearOnCloseproperty.- Property description:
- Specifies whether to remove (clear) the ModalPane content after it's closed.
- Returns:
- the value of the
clearOnCloseproperty - See Also:
-
setClearOnClose
public void setClearOnClose(boolean clearOnClose) Sets the value of theclearOnCloseproperty.- Property description:
- Specifies whether to remove (clear) the ModalPane content after it's closed.
- Parameters:
clearOnClose- the value for theclearOnCloseproperty- See Also:
-