- All Implemented Interfaces:
MFXStyleablePopup,Styleable,EventTarget,Skinnable
- Direct Known Subclasses:
MFXContextMenu,MFXTooltip
PopupControl.
Setting the popup's content is now easier, it is animated (can be disabled), the animation
can be changed but the most important features are the hover property and PseudoClass ("popup-hover" in css)
that specifies when the mouse is on the content, and the new show methods that make use of HPos
and VPos to compute the position for you, no more x and y computation, leave it to MFXPopup.
Of course if needed JavaFX's methods are still available.
Also allows to reposition the popup on demand by callingreposition() and also
offers a new EventType.
Now implements MFXStyleablePopup to make the popup customizable with CSS.
Please check the interface's documentation on how to use the functionality.-
Property Summary
PropertiesTypePropertyDescriptionSpecifies the popup's content.Specifies if the mouse is on the popup's content.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 -
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javafx.scene.control.PopupControl
PopupControl.CSSBridgeNested classes/interfaces inherited from class javafx.stage.PopupWindow
PopupWindow.AnchorLocation -
Field Summary
Fields inherited from class javafx.scene.control.PopupControl
USE_COMPUTED_SIZE, USE_PREF_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUsed to compute the new position of the popup when repositioning.Specifies the popup's content.protected Skin<?>static voidfixPosition(MFXPopup popup, boolean fix) Tells the given popup to recompute its position if it would end outside the screen.Gets the value of the property content.This method works just likeRegion.getUserAgentStylesheet().voidhide()Specifies if the mouse is on the popup's content.booleanSpecifies whether tha popup's is animated.static booleanisFixPosition(MFXPopup popup) booleanisHover()Gets the value of the property hover.voidRepositions the popup by recomputing the position from the previous stored info.voidsetAnimated(boolean animated) voidsetAnimationProvider(BiFunction<Node, Scale, Animation> animationProvider) Sets the function used by the skin to produce the popup's animation.voidsetContent(Node content) Sets the value of the property content.protected voidsetHover(boolean hover) Sets the value of the property hover.voidsetPopupStyleableParent(Parent parent) Sets the node that has the necessary stylesheets to customize the popup.voidShows the popup at the BOTTOM_RIGHT of the specified node.voidvoidShows the popup at the given positions.voidShows the popup at the given positions, then shifts the computed coordinates by the given offsets.Methods inherited from class javafx.scene.control.PopupControl
getClassCssMetaData, getCssMetaData, getId, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getPseudoClassStates, getSkin, getStyle, getStyleableNode, 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, 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
-
content
Specifies the popup's content.As of now changing the content while the popup is shown won't have any effect. For it to work, the popup must be closed and reopened again. As of now, there's no plan to improve this because such use case would introduce an unnecessary layer of complexity and in my opinion it's also a discouraged practice to change the popup's content while open. It would be better to use a container Pane and change its content.
This is a property because when the content changes it's needed to add the necessary handlers to it to make the "hover" feature work. The content cannot be null.- See Also:
-
hover
Specifies if the mouse is on the popup's content.- See Also:
-
-
Constructor Details
-
MFXPopup
public MFXPopup() -
MFXPopup
-
-
Method Details
-
show
- Overrides:
showin classPopupWindow
-
show
Shows the popup at the BOTTOM_RIGHT of the specified node. Callsshow(Node, Alignment, double, double). -
show
Shows the popup at the given positions. Callsshow(Node, Alignment, double, double). -
show
Shows the popup at the given positions, then shifts the computed coordinates by the given offsets. Once the position is computed, it is stored in aPopupPositionBeanalongside other useful info. These info are important because before the popup is actually shown, its skin is created. TheMFXPopupSkinuses these info to properly position and animate the popup. This is needed because before creating the skin the content is not laid out so its sizes/bounds are 0 and the "real" coordinates cannot be computed. For this reason, the coordinates stored in the position bean are not reliable, because they do not take into account the adjustments applied by the skin. (as of now, maybe will be improved in the future) -
reposition
public void reposition()Repositions the popup by recomputing the position from the previous stored info.This should be called when the owner's position changes.
This is also responsible for fixing the coordinates if the popup would end outside the screen -
computePosition
Used to compute the new position of the popup when repositioning. -
hide
public void hide()Overridden to set the storedPopupPositionBeanto null.- Overrides:
hidein classPopupWindow
-
createDefaultSkin
- Overrides:
createDefaultSkinin classPopupControl
-
getPopupStyleableParent
- Specified by:
getPopupStyleableParentin interfaceMFXStyleablePopup- Returns:
- the node that has the necessary stylesheets to customize the popup
-
setPopupStyleableParent
Description copied from interface:MFXStyleablePopupSets the node that has the necessary stylesheets to customize the popup.- Specified by:
setPopupStyleableParentin interfaceMFXStyleablePopup
-
getStyleableParent
- Specified by:
getStyleableParentin interfaceStyleable- Overrides:
getStyleableParentin classPopupControl
-
getStyleSheets
- Specified by:
getStyleSheetsin interfaceMFXStyleablePopup- Returns:
- the parsed stylesheets
-
getUserAgentStylesheet
Description copied from interface:MFXStyleablePopupThis method works just likeRegion.getUserAgentStylesheet(). AnyMFXStyleablePopupshould offer the possibility of setting a base stylesheet. It's up to the skin on how to use it though (an example can be found hereMFXContextMenuSkin).- Specified by:
getUserAgentStylesheetin interfaceMFXStyleablePopup
-
fixPosition
Tells the given popup to recompute its position if it would end outside the screen. -
isFixPosition
- Returns:
- whether the given popup is configured to reposition itself if ending outside the screen
-
getPosition
- Returns:
- the instance of the
PopupPositionBeancomputed when showing or repositioning the popup. Note that it will return null if the popup is not showing.
-
getContent
Gets the value of the property content.- Property description:
- Specifies the popup's content.
As of now changing the content while the popup is shown won't have any effect. For it to work, the popup must be closed and reopened again. As of now, there's no plan to improve this because such use case would introduce an unnecessary layer of complexity and in my opinion it's also a discouraged practice to change the popup's content while open. It would be better to use a container Pane and change its content.
This is a property because when the content changes it's needed to add the necessary handlers to it to make the "hover" feature work. The content cannot be null.
-
contentProperty
Specifies the popup's content.As of now changing the content while the popup is shown won't have any effect. For it to work, the popup must be closed and reopened again. As of now, there's no plan to improve this because such use case would introduce an unnecessary layer of complexity and in my opinion it's also a discouraged practice to change the popup's content while open. It would be better to use a container Pane and change its content.
This is a property because when the content changes it's needed to add the necessary handlers to it to make the "hover" feature work. The content cannot be null.- See Also:
-
setContent
Sets the value of the property content.- Property description:
- Specifies the popup's content.
As of now changing the content while the popup is shown won't have any effect. For it to work, the popup must be closed and reopened again. As of now, there's no plan to improve this because such use case would introduce an unnecessary layer of complexity and in my opinion it's also a discouraged practice to change the popup's content while open. It would be better to use a container Pane and change its content.
This is a property because when the content changes it's needed to add the necessary handlers to it to make the "hover" feature work. The content cannot be null.
-
getAnimationProvider
- Returns:
- the function used by the skin to produce the popup's animation
-
setAnimationProvider
-
isAnimated
public boolean isAnimated()Specifies whether tha popup's is animated. -
setAnimated
public void setAnimated(boolean animated) -
isHover
public boolean isHover()Gets the value of the property hover.- Property description:
- Specifies if the mouse is on the popup's content.
-
hoverProperty
Specifies if the mouse is on the popup's content.- See Also:
-
setHover
protected void setHover(boolean hover) Sets the value of the property hover.- Property description:
- Specifies if the mouse is on the popup's content.
-