Class PopupWindow
- All Implemented Interfaces:
HasHeightProperty,HasSceneProperty,HasWidthProperty,EventTarget
- Direct Known Subclasses:
PopupControl
Popup and Tooltip
and ContextMenu.
A PopupWindow is a secondary window which has no window decorations or title bar. It doesn't show up in the OS as a top-level window. It is typically used for tool tip like notification, drop down boxes, menus, and so forth.
The PopupWindow cannot be shown without an owner. PopupWindows require that an owner window exist in order to be shown. However, it is possible to create a PopupWindow ahead of time and simply set the owner (or change the owner) before first being made visible. Attempting to change the owner while the PopupWindow is visible will result in an IllegalStateException.
The PopupWindow encapsulates much of the behavior and functionality common to popups, such as the ability to close when the "esc" key is pressed, or the ability to hide all child popup windows whenever this window is hidden. These abilities can be enabled or disabled via properties.
- Since:
- JavaFX 2.0
-
Property Summary
PropertiesTypePropertyDescriptionSpecifies the popup anchor point which is used in popup positioning.final ReadOnlyDoublePropertySpecifies the x coordinate of the popup anchor point on the screen.final ReadOnlyDoublePropertySpecifies the y coordinate of the popup anchor point on the screen.final BooleanPropertySpecifies whether Popups should auto hide.final BooleanPropertySpecifies whether the event, which caused the Popup to hide, should be consumed.final ReadOnlyProperty<Node>The node which is the owner of this popup.final ReadOnlyProperty<Window>The window which is the parent of this popup.Properties inherited from class javafx.stage.Window
eventDispatcher, focused, height, onCloseRequest, scene, showing, width, x, y -
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAnchor location constants for popup anchor point selection. -
Field Summary
Fields inherited from class javafx.stage.Window
impl_peer, peerListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the popup anchor point which is used in popup positioning.final ReadOnlyDoublePropertySpecifies the x coordinate of the popup anchor point on the screen.final ReadOnlyDoublePropertySpecifies the y coordinate of the popup anchor point on the screen.final BooleanPropertySpecifies whether Popups should auto hide.final BooleanPropertySpecifies whether the event, which caused the Popup to hide, should be consumed.Gets the value of theanchorLocationproperty.final doubleGets the value of theanchorXproperty.final doubleGets the value of theanchorYproperty.final booleanGets the value of theconsumeAutoHidingEventsproperty.final NodeGets the value of theownerNodeproperty.final WindowGets the value of theownerWindowproperty.voidhide()Hide this Popup and all its childrenfinal booleanGets the value of theautoHideproperty.final ReadOnlyProperty<Node>The node which is the owner of this popup.final ReadOnlyProperty<Window>The window which is the parent of this popup.final voidSets the value of theanchorLocationproperty.final voidsetAnchorX(double value) Sets the value of theanchorXproperty.final voidsetAnchorY(double value) Sets the value of theanchorYproperty.final voidsetAutoHide(boolean value) Sets the value of theautoHideproperty.final voidsetConsumeAutoHidingEvents(boolean value) Sets the value of theconsumeAutoHidingEventsproperty.final voidNote to subclasses: the scene used by PopupWindow is very specifically managed by PopupWindow.voidShows the popup at the specified location on the screen.voidShow the popup.voidShows the popup at the specified location on the screen.Methods inherited from class javafx.stage.Window
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, createPeer, eventDispatcherProperty, fireEvent, focusedProperty, getEventDispatcher, getOnCloseRequest, getX, getY, heightProperty, impl_getPeer, isFocused, isShowing, notifySizeChanged, onCloseRequestProperty, removeEventFilter, removeEventHandler, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setHeight, setOnCloseRequest, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasHeightProperty
getHeight, setHeightMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasSceneProperty
getSceneMethods inherited from interface dev.webfx.kit.mapper.peers.javafxgraphics.markers.HasWidthProperty
getWidth, setWidth
-
Property Details
-
ownerWindow
The window which is the parent of this popup. All popups must have an owner window.- See Also:
-
ownerNode
The node which is the owner of this popup. All popups must have an owner window but are not required to be associated with an owner node. If an autohide Popup has an owner node, mouse press inside the owner node doesn't cause the Popup to hide.- See Also:
-
autoHide
Specifies whether Popups should auto hide. If a popup loses focus and autoHide is true, then the popup will be hidden automatically.The only exception is when owner Node is specified using
show(javafx.scene.Node, double, double). Focusing owner Node will not hide the PopupWindow.- Default value:
- false
- See Also:
-
consumeAutoHidingEvents
Specifies whether the event, which caused the Popup to hide, should be consumed. Having the event consumed prevents it from triggering some additional UI response in the Popup's owner window.- Default value:
- true
- Since:
- JavaFX 2.2
- See Also:
-
anchorX
Specifies the x coordinate of the popup anchor point on the screen. If theanchorLocationis set toWINDOW_TOP_LEFTorWINDOW_BOTTOM_LEFTthexandanchorXvalues will be identical.- Since:
- JavaFX 8.0
- See Also:
-
anchorY
Specifies the y coordinate of the popup anchor point on the screen. If theanchorLocationis set toWINDOW_TOP_LEFTorWINDOW_TOP_RIGHTtheyandanchorYvalues will be identical.- Since:
- JavaFX 8.0
- See Also:
-
anchorLocation
Specifies the popup anchor point which is used in popup positioning. The point can be set to a corner of the popup window or a corner of its content. In this context the content corners are derived from the popup root node's layout bounds.In general changing of the anchor location won't change the current window position. Instead of that, the
anchorXandanchorYvalues are recalculated to correspond to the new anchor point.- Since:
- JavaFX 8.0
- See Also:
-
-
Constructor Details
-
PopupWindow
public PopupWindow()
-
-
Method Details
-
getOwnerWindow
Gets the value of theownerWindowproperty.- Property description:
- The window which is the parent of this popup. All popups must have an owner window.
- Returns:
- the value of the
ownerWindowproperty - See Also:
-
ownerWindowProperty
The window which is the parent of this popup. All popups must have an owner window.- Returns:
- the
ownerWindowproperty - See Also:
-
getOwnerNode
Gets the value of theownerNodeproperty.- Property description:
- The node which is the owner of this popup. All popups must have an owner window but are not required to be associated with an owner node. If an autohide Popup has an owner node, mouse press inside the owner node doesn't cause the Popup to hide.
- Returns:
- the value of the
ownerNodeproperty - See Also:
-
ownerNodeProperty
The node which is the owner of this popup. All popups must have an owner window but are not required to be associated with an owner node. If an autohide Popup has an owner node, mouse press inside the owner node doesn't cause the Popup to hide.- Returns:
- the
ownerNodeproperty - See Also:
-
setScene
Note to subclasses: the scene used by PopupWindow is very specifically managed by PopupWindow. This method is overridden to throw UnsupportedOperationException. You cannot specify your own scene.- Parameters:
scene-- See Also:
-
setAutoHide
public final void setAutoHide(boolean value) Sets the value of theautoHideproperty.- Property description:
- Specifies whether Popups should auto hide. If a popup loses focus and
autoHide is true, then the popup will be hidden automatically.
The only exception is when owner Node is specified using
show(javafx.scene.Node, double, double). Focusing owner Node will not hide the PopupWindow. - Default value:
- false
- Parameters:
value- the value for theautoHideproperty- See Also:
-
isAutoHide
public final boolean isAutoHide()Gets the value of theautoHideproperty.- Property description:
- Specifies whether Popups should auto hide. If a popup loses focus and
autoHide is true, then the popup will be hidden automatically.
The only exception is when owner Node is specified using
show(javafx.scene.Node, double, double). Focusing owner Node will not hide the PopupWindow. - Default value:
- false
- Returns:
- the value of the
autoHideproperty - See Also:
-
autoHideProperty
Specifies whether Popups should auto hide. If a popup loses focus and autoHide is true, then the popup will be hidden automatically.The only exception is when owner Node is specified using
show(javafx.scene.Node, double, double). Focusing owner Node will not hide the PopupWindow.- Default value:
- false
- Returns:
- the
autoHideproperty - See Also:
-
setConsumeAutoHidingEvents
public final void setConsumeAutoHidingEvents(boolean value) Sets the value of theconsumeAutoHidingEventsproperty.- Property description:
- Specifies whether the event, which caused the Popup to hide, should be consumed. Having the event consumed prevents it from triggering some additional UI response in the Popup's owner window.
- Default value:
- true
- Parameters:
value- the value for theconsumeAutoHidingEventsproperty- Since:
- JavaFX 2.2
- See Also:
-
getConsumeAutoHidingEvents
public final boolean getConsumeAutoHidingEvents()Gets the value of theconsumeAutoHidingEventsproperty.- Property description:
- Specifies whether the event, which caused the Popup to hide, should be consumed. Having the event consumed prevents it from triggering some additional UI response in the Popup's owner window.
- Default value:
- true
- Returns:
- the value of the
consumeAutoHidingEventsproperty - Since:
- JavaFX 2.2
- See Also:
-
consumeAutoHidingEventsProperty
Specifies whether the event, which caused the Popup to hide, should be consumed. Having the event consumed prevents it from triggering some additional UI response in the Popup's owner window.- Default value:
- true
- Returns:
- the
consumeAutoHidingEventsproperty - Since:
- JavaFX 2.2
- See Also:
-
show
Show the popup.- Parameters:
owner- The owner of the popup. This must not be null.- Throws:
NullPointerException- if owner is nullIllegalArgumentException- if the specified owner window would create cycle in the window hierarchy
-
show
Shows the popup at the specified location on the screen. The popup window is positioned in such way that its anchor point () is displayed at the specifiedanchorXandanchorYcoordinates.The popup is associated with the specified owner node. The
Windowwhich contains the owner node at the time of the call becomes an owner window of the displayed popup.Note that when
autoHideProperty()is set to true, mouse press on the owner Node will not hide the PopupWindow.- Parameters:
ownerNode- The owner Node of the popup. It must not be null and must be associated with a Window.anchorX- the x position of the popup anchor in screen coordinatesanchorY- the y position of the popup anchor in screen coordinates- Throws:
NullPointerException- if ownerNode is nullIllegalArgumentException- if the specified owner node is not associated with a Window or when the window would create cycle in the window hierarchy
-
show
Shows the popup at the specified location on the screen. The popup window is positioned in such way that its anchor point () is displayed at the specifiedanchorXandanchorYcoordinates.- Parameters:
ownerWindow- The owner of the popup. This must not be null.anchorX- the x position of the popup anchor in screen coordinatesanchorY- the y position of the popup anchor in screen coordinates- Throws:
NullPointerException- if ownerWindow is nullIllegalArgumentException- if the specified owner window would create cycle in the window hierarchy
-
hide
public void hide()Hide this Popup and all its children -
setAnchorX
public final void setAnchorX(double value) Sets the value of theanchorXproperty.- Property description:
- Specifies the x coordinate of the popup anchor point on the screen. If
the
anchorLocationis set toWINDOW_TOP_LEFTorWINDOW_BOTTOM_LEFTthexandanchorXvalues will be identical. - Parameters:
value- the value for theanchorXproperty- Since:
- JavaFX 8.0
- See Also:
-
getAnchorX
public final double getAnchorX()Gets the value of theanchorXproperty.- Property description:
- Specifies the x coordinate of the popup anchor point on the screen. If
the
anchorLocationis set toWINDOW_TOP_LEFTorWINDOW_BOTTOM_LEFTthexandanchorXvalues will be identical. - Returns:
- the value of the
anchorXproperty - Since:
- JavaFX 8.0
- See Also:
-
anchorXProperty
Specifies the x coordinate of the popup anchor point on the screen. If theanchorLocationis set toWINDOW_TOP_LEFTorWINDOW_BOTTOM_LEFTthexandanchorXvalues will be identical.- Returns:
- the
anchorXproperty - Since:
- JavaFX 8.0
- See Also:
-
setAnchorY
public final void setAnchorY(double value) Sets the value of theanchorYproperty.- Property description:
- Specifies the y coordinate of the popup anchor point on the screen. If
the
anchorLocationis set toWINDOW_TOP_LEFTorWINDOW_TOP_RIGHTtheyandanchorYvalues will be identical. - Parameters:
value- the value for theanchorYproperty- Since:
- JavaFX 8.0
- See Also:
-
getAnchorY
public final double getAnchorY()Gets the value of theanchorYproperty.- Property description:
- Specifies the y coordinate of the popup anchor point on the screen. If
the
anchorLocationis set toWINDOW_TOP_LEFTorWINDOW_TOP_RIGHTtheyandanchorYvalues will be identical. - Returns:
- the value of the
anchorYproperty - Since:
- JavaFX 8.0
- See Also:
-
anchorYProperty
Specifies the y coordinate of the popup anchor point on the screen. If theanchorLocationis set toWINDOW_TOP_LEFTorWINDOW_TOP_RIGHTtheyandanchorYvalues will be identical.- Returns:
- the
anchorYproperty - Since:
- JavaFX 8.0
- See Also:
-
setAnchorLocation
Sets the value of theanchorLocationproperty.- Property description:
- Specifies the popup anchor point which is used in popup positioning. The
point can be set to a corner of the popup window or a corner of its
content. In this context the content corners are derived from the popup
root node's layout bounds.
In general changing of the anchor location won't change the current window position. Instead of that, the
anchorXandanchorYvalues are recalculated to correspond to the new anchor point. - Parameters:
value- the value for theanchorLocationproperty- Since:
- JavaFX 8.0
- See Also:
-
getAnchorLocation
Gets the value of theanchorLocationproperty.- Property description:
- Specifies the popup anchor point which is used in popup positioning. The
point can be set to a corner of the popup window or a corner of its
content. In this context the content corners are derived from the popup
root node's layout bounds.
In general changing of the anchor location won't change the current window position. Instead of that, the
anchorXandanchorYvalues are recalculated to correspond to the new anchor point. - Returns:
- the value of the
anchorLocationproperty - Since:
- JavaFX 8.0
- See Also:
-
anchorLocationProperty
Specifies the popup anchor point which is used in popup positioning. The point can be set to a corner of the popup window or a corner of its content. In this context the content corners are derived from the popup root node's layout bounds.In general changing of the anchor location won't change the current window position. Instead of that, the
anchorXandanchorYvalues are recalculated to correspond to the new anchor point.- Returns:
- the
anchorLocationproperty - Since:
- JavaFX 8.0
- See Also:
-