Class PopOver
java.lang.Object
javafx.stage.Window
javafx.stage.PopupWindow
javafx.scene.control.PopupControl
com.dlsc.gemsfx.PopOver
- All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable
- Direct Known Subclasses:
PopOver.CalendarPopOver
public class PopOver
extends javafx.scene.control.PopupControl
A control that is intended to provide detailed information about
an owning node in a popup window. The popup window has a lightweight
appearance (no default window decorations) and an arrow pointing at the owner.
Due to the nature of popup windows, the popover will move around with the parent
window when the user drags it.
The Popover can be detached from the owning node by dragging it away from the owner.
Example
var textFlow = new TextFlow(new Text("Some content"));
textFlow.setPrefWidth(300);
var popover = new Popover(textFlow);
var ownerLink = new Hyperlink("Show popover");
ownerLink.setOnAction(e -> popover.show(ownerLink));
CSS Styleable Properties:
| Property | Type | Description |
|---|---|---|
-fx-arrow-indent | Double | Distance between the arrow and popup corners. |
-fx-arrow-size | Double | The size of the arrow. |
-fx-corner-radius | Double | The corner radius of the popover. |
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumLocations where the arrow of the popover can be placed.static classA specialized popover to let the user select a date or a date range.Nested classes/interfaces inherited from class javafx.scene.control.PopupControl
javafx.scene.control.PopupControl.CSSBridgeNested classes/interfaces inherited from class javafx.stage.PopupWindow
javafx.stage.PopupWindow.AnchorLocation -
Property Summary
PropertiesTypePropertyDescriptionfinal javafx.beans.property.BooleanPropertyStores the "animated" flag.final javafx.beans.property.DoublePropertyControls the distance between the arrow and the corners of the popover.final javafx.beans.property.ObjectProperty<PopOver.ArrowLocation> final javafx.beans.property.DoublePropertyControls the size of the arrow.final javafx.beans.property.ReadOnlyObjectProperty<PopOver.ArrowLocation> The effective arrow location that is actually used to draw and position the popover.final javafx.beans.property.ObjectProperty<javafx.scene.Node> Returns the content shown by the popover.final javafx.beans.property.DoublePropertyReturns the corner radius property for the popover.final javafx.beans.property.BooleanPropertyDetermines if the popover is detachable at all.final javafx.beans.property.BooleanPropertyDetermines whether the popover is detached from the owning node or not.final javafx.beans.property.ObjectProperty<javafx.util.Duration> Stores the fade-in duration.final javafx.beans.property.ObjectProperty<javafx.util.Duration> Stores the fade-out duration.Properties inherited from class javafx.scene.control.PopupControl
id, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth, skin, styleProperties inherited from class javafx.stage.PopupWindow
anchorLocation, anchorX, anchorY, autoFix, autoHide, consumeAutoHidingEvents, hideOnEscape, onAutoHide, ownerNode, ownerWindowProperties inherited from class javafx.stage.Window
eventDispatcher, focused, forceIntegerRenderScale, height, onCloseRequest, onHidden, onHiding, onShowing, onShown, opacity, outputScaleX, outputScaleY, renderScaleX, renderScaleY, scene, showing, width, x, y -
Field Summary
FieldsFields inherited from class javafx.scene.control.PopupControl
bridge, USE_COMPUTED_SIZE, USE_PREF_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal javafx.beans.property.BooleanPropertyStores the "animated" flag.final javafx.beans.property.DoublePropertyControls the distance between the arrow and the corners of the popover.final javafx.beans.property.ObjectProperty<PopOver.ArrowLocation> final javafx.beans.property.DoublePropertyControls the size of the arrow.final javafx.beans.property.ReadOnlyObjectProperty<PopOver.ArrowLocation> The effective arrow location that is actually used to draw and position the popover.final javafx.beans.property.ObjectProperty<javafx.scene.Node> Returns the content shown by the popover.final javafx.beans.property.DoublePropertyReturns the corner radius property for the popover.protected javafx.scene.control.Skin<?> Creates the default skin for this control.final voiddetach()Detaches the popover from the owning node.final javafx.beans.property.BooleanPropertyDetermines if the popover is detachable at all.final javafx.beans.property.BooleanPropertyDetermines whether the popover is detached from the owning node or not.final javafx.beans.property.ObjectProperty<javafx.util.Duration> Stores the fade-in duration.final javafx.beans.property.ObjectProperty<javafx.util.Duration> Stores the fade-out duration.final doubleGets the value of thearrowIndentproperty.final PopOver.ArrowLocationGets the value of thearrowLocationproperty.final doubleGets the value of thearrowSizeproperty.final PopOver.ArrowLocationGets the value of thecomputedArrowLocationproperty.final javafx.scene.NodeGets the value of thecontentNodeproperty.final doubleGets the value of thecornerRadiusproperty.final javafx.util.DurationGets the value of thefadeInDurationproperty.final javafx.util.DurationGets the value of thefadeOutDurationproperty.final javafx.scene.layout.StackPanegetRoot()The root pane stores the content node of the popover.final voidhide()Hides the popover by quickly changing its opacity to 0.final voidhide(javafx.util.Duration fadeOutDuration) Hides the popover by quickly changing its opacity to 0.final booleanGets the value of theanimatedproperty.final booleanGets the value of thedetachableproperty.final booleanGets the value of thedetachedproperty.final voidsetAnimated(boolean animated) Sets the value of theanimatedproperty.final voidsetArrowIndent(double size) Sets the value of thearrowIndentproperty.final voidsetArrowLocation(PopOver.ArrowLocation location) Sets the value of thearrowLocationproperty.final voidsetArrowSize(double size) Sets the value of thearrowSizeproperty.final voidsetContentNode(javafx.scene.Node content) Sets the value of thecontentNodeproperty.final voidsetCornerRadius(double radius) Sets the value of thecornerRadiusproperty.final voidsetDetachable(boolean detachable) Sets the value of thedetachableproperty.final voidsetDetached(boolean detached) Sets the value of thedetachedproperty.final voidsetFadeInDuration(javafx.util.Duration duration) Sets the value of thefadeInDurationproperty.final voidsetFadeOutDuration(javafx.util.Duration duration) Sets the value of thefadeOutDurationproperty.final voidshow(javafx.scene.Node owner) Shows the popover in a position relative to the edges of the given owner node.final voidshow(javafx.scene.Node owner, double offset) Shows the popover in a position relative to the edges of the given owner node.final voidshow(javafx.scene.Node owner, javafx.geometry.Bounds bounds) final voidshow(javafx.scene.Node owner, javafx.geometry.Bounds bounds, double offset) Shows the popover in a position relative to the given bounds (in screen coordinates) of the owner node.Methods inherited from class javafx.scene.control.PopupControl
getClassCssMetaData, getCssMetaData, getId, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getPseudoClassStates, getSkin, getStyle, getStyleableNode, getStyleableParent, getStyleClass, getTypeSelector, idProperty, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, pseudoClassStateChanged, setId, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefWidth, setSkin, setStyle, skinProperty, stylePropertyMethods inherited from class javafx.stage.PopupWindow
anchorLocationProperty, anchorXProperty, anchorYProperty, autoFixProperty, autoHideProperty, consumeAutoHidingEventsProperty, getAnchorLocation, getAnchorX, getAnchorY, getConsumeAutoHidingEvents, getOnAutoHide, getOwnerNode, getOwnerWindow, hideOnEscapeProperty, isAutoFix, isAutoHide, isHideOnEscape, onAutoHideProperty, ownerNodeProperty, ownerWindowProperty, setAnchorLocation, setAnchorX, setAnchorY, setAutoFix, setAutoHide, setConsumeAutoHidingEvents, setHideOnEscape, setOnAutoHide, setScene, show, show, showMethods inherited from class javafx.stage.Window
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, forceIntegerRenderScaleProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getOutputScaleX, getOutputScaleY, getProperties, getRenderScaleX, getRenderScaleY, getScene, getUserData, getWidth, getWindows, getX, getY, hasProperties, heightProperty, isFocused, isForceIntegerRenderScale, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, outputScaleXProperty, outputScaleYProperty, removeEventFilter, removeEventHandler, renderScaleXProperty, renderScaleYProperty, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setForceIntegerRenderScale, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setRenderScaleX, setRenderScaleY, setUserData, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
-
Property Details
-
contentNode
public final javafx.beans.property.ObjectProperty<javafx.scene.Node> contentNodePropertyReturns the content shown by the popover.- See Also:
-
detachable
public final javafx.beans.property.BooleanProperty detachablePropertyDetermines if the popover is detachable at all.- See Also:
-
detached
public final javafx.beans.property.BooleanProperty detachedPropertyDetermines whether the popover is detached from the owning node or not. A detached popover no longer shows an arrow pointing at the owner and features its own title bar.- See Also:
-
arrowSize
public final javafx.beans.property.DoubleProperty arrowSizePropertyControls the size of the arrow. The default value is 10.- See Also:
-
arrowIndent
public final javafx.beans.property.DoubleProperty arrowIndentPropertyControls the distance between the arrow and the corners of the popover. The default value is 12.- See Also:
-
cornerRadius
public final javafx.beans.property.DoubleProperty cornerRadiusPropertyReturns the corner radius property for the popover.- See Also:
-
arrowLocation
- See Also:
-
computedArrowLocation
public final javafx.beans.property.ReadOnlyObjectProperty<PopOver.ArrowLocation> computedArrowLocationPropertyThe effective arrow location that is actually used to draw and position the popover. It equals the preferredarrow locationunless the popover had to be flipped to the opposite side in order to stay on screen. Skins should render the arrow based on this property rather than onarrowLocationProperty().- See Also:
-
fadeInDuration
public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeInDurationPropertyStores the fade-in duration. This should be set before calling PopOver.show(…).- See Also:
-
fadeOutDuration
public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeOutDurationPropertyStores the fade-out duration.- See Also:
-
animated
public final javafx.beans.property.BooleanProperty animatedPropertyStores the "animated" flag. If true, then the PopOver will be shown / hidden with a short fade in / out animation.- See Also:
-
-
Field Details
-
DEFAULT_OFFSET
public static final int DEFAULT_OFFSET- See Also:
-
-
Constructor Details
-
PopOver
public PopOver()Creates a popover with a label as the content node. -
PopOver
public PopOver(javafx.scene.Node content) Creates a popover with the given node as the content node.- Parameters:
content- The content shown by the popover
-
-
Method Details
-
createDefaultSkin
protected javafx.scene.control.Skin<?> createDefaultSkin()Creates the default skin for this control.- Overrides:
createDefaultSkinin classjavafx.scene.control.PopupControl- Returns:
- the default skin
-
getRoot
public final javafx.scene.layout.StackPane getRoot()The root pane stores the content node of the popover. It is accessible via this method to support proper styling.Example:
Popover popOver = new Popover(); popOver.getRoot().getStylesheets().add(...);- Returns:
- the root pane
-
contentNodeProperty
public final javafx.beans.property.ObjectProperty<javafx.scene.Node> contentNodeProperty()Returns the content shown by the popover.- Returns:
- the content node property
- See Also:
-
getContentNode
public final javafx.scene.Node getContentNode()Gets the value of thecontentNodeproperty.- Property description:
- Returns the content shown by the popover.
- Returns:
- the value of the
contentNodeproperty - See Also:
-
setContentNode
public final void setContentNode(javafx.scene.Node content) Sets the value of thecontentNodeproperty.- Property description:
- Returns the content shown by the popover.
- Parameters:
content- the value for thecontentNodeproperty- See Also:
-
show
public final void show(javafx.scene.Node owner) Shows the popover in a position relative to the edges of the given owner node. The position is dependent on the arrow location. If the arrow is pointing to the right, then the popover will be placed to the left of the given owner. If the arrow points up, then the popover will be placed below the given owner node. The arrow will slightly overlap with the owner node.- Parameters:
owner- the owner of the popover
-
show
public final void show(javafx.scene.Node owner, double offset) Shows the popover in a position relative to the edges of the given owner node. The position is dependent on the arrow location. If the arrow is pointing to the right, then the popover will be placed to the left of the given owner. If the arrow points up, then the popover will be placed below the given owner node.- Parameters:
owner- the owner of the popoveroffset- if negative specifies the distance to the owner node, or when positive specifies the number of pixels that the arrow will overlap with the owner node (positive values are recommended)
-
show
public final void show(javafx.scene.Node owner, javafx.geometry.Bounds bounds) -
show
public final void show(javafx.scene.Node owner, javafx.geometry.Bounds bounds, double offset) Shows the popover in a position relative to the given bounds (in screen coordinates) of the owner node. The concrete side on which the popover appears is derived from thearrow location, which is treated as the preferred location: if the popover would not fit on the preferred side of the owner within the visual bounds of the screen, it is automatically flipped to the opposite side (AppleNSPopover-style behavior). The publicarrow locationproperty is never modified by this method; the effective location is exposed viacomputedArrowLocationProperty().- Parameters:
owner- the owner of the popoverbounds- the owner's bounds in screen coordinates that the popover points atoffset- if positive specifies the number of pixels that the arrow will overlap with the owner node (positive values are recommended)
-
hide
public final void hide()Hides the popover by quickly changing its opacity to 0.- Overrides:
hidein classjavafx.stage.PopupWindow- See Also:
-
hide
public final void hide(javafx.util.Duration fadeOutDuration) Hides the popover by quickly changing its opacity to 0.- Parameters:
fadeOutDuration- the duration of the fade transition that is being used to change the opacity of the popover- Since:
- 1.0
-
detach
public final void detach()Detaches the popover from the owning node. The popover will no longer display an arrow pointing at the owner node. -
detachableProperty
public final javafx.beans.property.BooleanProperty detachableProperty()Determines if the popover is detachable at all.- Returns:
- the detachable property
- See Also:
-
setDetachable
public final void setDetachable(boolean detachable) Sets the value of thedetachableproperty.- Property description:
- Determines if the popover is detachable at all.
- Parameters:
detachable- the value for thedetachableproperty- See Also:
-
isDetachable
public final boolean isDetachable()Gets the value of thedetachableproperty.- Property description:
- Determines if the popover is detachable at all.
- Returns:
- the value of the
detachableproperty - See Also:
-
detachedProperty
public final javafx.beans.property.BooleanProperty detachedProperty()Determines whether the popover is detached from the owning node or not. A detached popover no longer shows an arrow pointing at the owner and features its own title bar.- Returns:
- the detached property
- See Also:
-
setDetached
public final void setDetached(boolean detached) Sets the value of thedetachedproperty.- Property description:
- Determines whether the popover is detached from the owning node or not. A detached popover no longer shows an arrow pointing at the owner and features its own title bar.
- Parameters:
detached- the value for thedetachedproperty- See Also:
-
isDetached
public final boolean isDetached()Gets the value of thedetachedproperty.- Property description:
- Determines whether the popover is detached from the owning node or not. A detached popover no longer shows an arrow pointing at the owner and features its own title bar.
- Returns:
- the value of the
detachedproperty - See Also:
-
arrowSizeProperty
public final javafx.beans.property.DoubleProperty arrowSizeProperty()Controls the size of the arrow. The default value is 10.- Returns:
- the arrow size property
- See Also:
-
getArrowSize
public final double getArrowSize()Gets the value of thearrowSizeproperty.- Property description:
- Controls the size of the arrow. The default value is 10.
- Returns:
- the value of the
arrowSizeproperty - See Also:
-
setArrowSize
public final void setArrowSize(double size) Sets the value of thearrowSizeproperty.- Property description:
- Controls the size of the arrow. The default value is 10.
- Parameters:
size- the value for thearrowSizeproperty- See Also:
-
arrowIndentProperty
public final javafx.beans.property.DoubleProperty arrowIndentProperty()Controls the distance between the arrow and the corners of the popover. The default value is 12.- Returns:
- the arrow indent property
- See Also:
-
getArrowIndent
public final double getArrowIndent()Gets the value of thearrowIndentproperty.- Property description:
- Controls the distance between the arrow and the corners of the popover. The default value is 12.
- Returns:
- the value of the
arrowIndentproperty - See Also:
-
setArrowIndent
public final void setArrowIndent(double size) Sets the value of thearrowIndentproperty.- Property description:
- Controls the distance between the arrow and the corners of the popover. The default value is 12.
- Parameters:
size- the value for thearrowIndentproperty- See Also:
-
cornerRadiusProperty
public final javafx.beans.property.DoubleProperty cornerRadiusProperty()Returns the corner radius property for the popover.- Returns:
- the corner radius property (default is 6)
- See Also:
-
getCornerRadius
public final double getCornerRadius()Gets the value of thecornerRadiusproperty.- Property description:
- Returns the corner radius property for the popover.
- Returns:
- the value of the
cornerRadiusproperty - See Also:
-
setCornerRadius
public final void setCornerRadius(double radius) Sets the value of thecornerRadiusproperty.- Property description:
- Returns the corner radius property for the popover.
- Parameters:
radius- the value for thecornerRadiusproperty- See Also:
-
arrowLocationProperty
- Returns:
- the
arrowLocationproperty - See Also:
-
setArrowLocation
Sets the value of thearrowLocationproperty.- Property description:
- Parameters:
location- the value for thearrowLocationproperty- See Also:
-
getArrowLocation
Gets the value of thearrowLocationproperty.- Property description:
- Returns:
- the value of the
arrowLocationproperty - See Also:
-
computedArrowLocationProperty
public final javafx.beans.property.ReadOnlyObjectProperty<PopOver.ArrowLocation> computedArrowLocationProperty()The effective arrow location that is actually used to draw and position the popover. It equals the preferredarrow locationunless the popover had to be flipped to the opposite side in order to stay on screen. Skins should render the arrow based on this property rather than onarrowLocationProperty().- Returns:
- the read-only computed arrow location property
- See Also:
-
getComputedArrowLocation
Gets the value of thecomputedArrowLocationproperty.- Property description:
- The effective arrow location that is actually used to draw and position the
popover. It equals the preferred
arrow locationunless the popover had to be flipped to the opposite side in order to stay on screen. Skins should render the arrow based on this property rather than onarrowLocationProperty(). - Returns:
- the value of the
computedArrowLocationproperty - See Also:
-
fadeInDurationProperty
public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeInDurationProperty()Stores the fade-in duration. This should be set before calling PopOver.show(…).- Returns:
- the fade-in duration property
- See Also:
-
fadeOutDurationProperty
public final javafx.beans.property.ObjectProperty<javafx.util.Duration> fadeOutDurationProperty()Stores the fade-out duration.- Returns:
- the fade-out duration property
- See Also:
-
getFadeInDuration
public final javafx.util.Duration getFadeInDuration()Gets the value of thefadeInDurationproperty.- Property description:
- Stores the fade-in duration. This should be set before calling PopOver.show(…).
- Returns:
- the value of the
fadeInDurationproperty - See Also:
-
setFadeInDuration
public final void setFadeInDuration(javafx.util.Duration duration) Sets the value of thefadeInDurationproperty.- Property description:
- Stores the fade-in duration. This should be set before calling PopOver.show(…).
- Parameters:
duration- the value for thefadeInDurationproperty- See Also:
-
getFadeOutDuration
public final javafx.util.Duration getFadeOutDuration()Gets the value of thefadeOutDurationproperty.- Property description:
- Stores the fade-out duration.
- Returns:
- the value of the
fadeOutDurationproperty - See Also:
-
setFadeOutDuration
public final void setFadeOutDuration(javafx.util.Duration duration) Sets the value of thefadeOutDurationproperty.- Property description:
- Stores the fade-out duration.
- Parameters:
duration- the value for thefadeOutDurationproperty- See Also:
-
animatedProperty
public final javafx.beans.property.BooleanProperty animatedProperty()Stores the "animated" flag. If true, then the PopOver will be shown / hidden with a short fade in / out animation.- Returns:
- the "animated" property
- See Also:
-
isAnimated
public final boolean isAnimated()Gets the value of theanimatedproperty.- Property description:
- Stores the "animated" flag. If true, then the PopOver will be shown / hidden with a short fade in / out animation.
- Returns:
- the value of the
animatedproperty - See Also:
-
setAnimated
public final void setAnimated(boolean animated) Sets the value of theanimatedproperty.- Property description:
- Stores the "animated" flag. If true, then the PopOver will be shown / hidden with a short fade in / out animation.
- Parameters:
animated- the value for theanimatedproperty- See Also:
-