Popup and javafx.scene.control.Tooltip
and javafx.scene.control.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.
| Modifier and Type | Class and Description |
|---|---|
| public static enum | PopupWindow.
Anchor location constants for popup anchor point selection. |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ObjectProperty | anchorLocation
Specifies the popup anchor point which is used in popup positioning. |
| private final ReadOnlyDoubleWrapper | anchorX
Specifies the x coordinate of the popup anchor point on the screen. |
| private final ReadOnlyDoubleWrapper | anchorY
Specifies the y coordinate of the popup anchor point on the screen. |
| private BooleanProperty | autoFix
This convenience variable indicates whether, when the popup is shown, it should automatically correct its position such that it doesn't end up positioned off the screen. |
| private boolean | |
| private BooleanProperty | autoHide
Specifies whether Popups should auto hide. |
| private boolean | |
| private Bounds | |
| private Bounds | |
| private ChangeListener | changeListener
JDK-8088846: When a parent node or parent window we are associated with is not visible anymore, possibly because the scene was not valid anymore, we should hide. |
| private final List | children
A private list of all child popups. |
| private BooleanProperty | consumeAutoHidingEvents
Specifies whether the event, which caused the Popup to hide, should be consumed. |
| private BooleanProperty | hideOnEscape
Specifies whether the PopupWindow should be hidden when an unhandled escape key is pressed while the popup has focus. |
| private ObjectProperty | onAutoHide
Called after autoHide is run. |
| private ChangeListener | |
| private ReadOnlyObjectWrapper | ownerNode
The node which is the owner of this popup. |
| private ReadOnlyObjectWrapper | ownerWindow
The window which is the parent of this popup. |
| private final InvalidationListener | popupWindowUpdater
Keeps track of the bounds of the content, and adjust the position and size of the popup window accordingly. |
| private Window | |
| private TreeShowingProperty | |
| private WeakChangeListener |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final ObjectProperty | |
| public final ReadOnlyDoubleProperty | |
| public final ReadOnlyDoubleProperty | |
| pack-priv void | applyStylesheetFromOwner(Window
the owner owner)WindowApplies the stylesheet from the scene of the root owner |
| public final BooleanProperty | |
| public final BooleanProperty | |
| private void | |
| public final BooleanProperty | |
| pack-priv WindowEventDispatcher | |
| pack-priv void | |
| private void | |
| private void | |
| private Bounds | |
| public final PopupWindow. | |
| public final double | |
| public final double | |
| public final boolean | |
| pack-priv ObservableList | |
| private Bounds | |
| public final EventHandler | |
| public final Node | |
| public final Window | |
| private static Window | getRootWindow(Window
the Window for which to get the root window win)Gets the root (non PopupWindow) Window for the provided window. |
| pack-priv Window | |
| private void | |
| private void | |
| public void | |
| public final BooleanProperty | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| pack-priv void | notifyLocationChanged(final double
the new window x position newX, final double the new window y position newY)Overrides javafx. Notification from the windowing system that the window's position has changed. |
| public final ObjectProperty | |
| public final ReadOnlyObjectProperty | |
| public final ReadOnlyObjectProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| protected final void | setScene(Scene
the scene to be rendered on this window scene)Overrides javafx. Note to subclasses: the scene used by PopupWindow is very specifically managed by PopupWindow. |
| pack-priv void | |
| pack-priv void | |
| public void | |
| public void | show(Node
The owner Node of the popup. It must not be null
and must be associated with a Window. ownerNode, double the x position of the popup anchor in screen coordinates anchorX, double the y position of the popup anchor in screen coordinates anchorY)Shows the popup at the specified location on the screen. |
| public void | |
| private void | |
| private void | |
| private void | |
| private void | |
| private Bounds | |
| private void | |
| private void | |
| private double | |
| private double | |
| private static boolean |
| anchorLocation | back to summary |
|---|---|
| private final ObjectProperty<PopupWindow. 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
| |
| anchorX | back to summary |
|---|---|
| private final ReadOnlyDoubleWrapper anchorX Specifies the x coordinate of the popup anchor point on the screen. If
the
| |
| anchorY | back to summary |
|---|---|
| private final ReadOnlyDoubleWrapper anchorY Specifies the y coordinate of the popup anchor point on the screen. If
the
| |
| autoFix | back to summary |
|---|---|
| private BooleanProperty autoFix This convenience variable indicates whether, when the popup is shown, it should automatically correct its position such that it doesn't end up positioned off the screen.
| |
| autofixActive | back to summary |
|---|---|
| private boolean autofixActive | |
| autoHide | back to summary |
|---|---|
| private BooleanProperty 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
| |
| autohideActive | back to summary |
|---|---|
| private boolean autohideActive | |
| cachedAnchorBounds | back to summary |
|---|---|
| private Bounds cachedAnchorBounds | |
| cachedExtendedBounds | back to summary |
|---|---|
| private Bounds cachedExtendedBounds | |
| changeListener | back to summary |
|---|---|
| private ChangeListener<Boolean> changeListener JDK-8088846: When a parent node or parent window we are associated with is not visible anymore, possibly because the scene was not valid anymore, we should hide. | |
| children | back to summary |
|---|---|
| private final List<PopupWindow> children A private list of all child popups. | |
| consumeAutoHidingEvents | back to summary |
|---|---|
| private BooleanProperty 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.
| |
| hideOnEscape | back to summary |
|---|---|
| private BooleanProperty hideOnEscape Specifies whether the PopupWindow should be hidden when an unhandled escape key is pressed while the popup has focus.
| |
| onAutoHide | back to summary |
|---|---|
| private ObjectProperty<EventHandler<Event>> onAutoHide Called after autoHide is run. | |
| ownerFocusedListener | back to summary |
|---|---|
| private ChangeListener<Boolean> ownerFocusedListener | |
| ownerNode | back to summary |
|---|---|
| private ReadOnlyObjectWrapper<Node> 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. | |
| ownerWindow | back to summary |
|---|---|
| private ReadOnlyObjectWrapper<Window> ownerWindow The window which is the parent of this popup. All popups must have an owner window. | |
| popupWindowUpdater | back to summary |
|---|---|
| private final InvalidationListener popupWindowUpdater Keeps track of the bounds of the content, and adjust the position and size of the popup window accordingly. This way as the popup content changes, the window will be changed to match. | |
| rootWindow | back to summary |
|---|---|
| private Window rootWindow | |
| treeShowingProperty | back to summary |
|---|---|
| private TreeShowingProperty treeShowingProperty | |
| weakOwnerNodeListener | back to summary |
|---|---|
| private WeakChangeListener<Boolean> weakOwnerNodeListener | |
| PopupWindow | back to summary |
|---|---|
| public PopupWindow() Constructor for subclasses to call. | |
| anchorLocationProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| anchorXProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty anchorXProperty() | |
| anchorYProperty | back to summary |
|---|---|
| public final ReadOnlyDoubleProperty anchorYProperty() | |
| applyStylesheetFromOwner | back to summary |
|---|---|
| pack-priv void applyStylesheetFromOwner(Window owner) Applies the stylesheet from the scene of the root owner | |
| autoFixProperty | back to summary |
|---|---|
| public final BooleanProperty autoFixProperty() | |
| autoHideProperty | back to summary |
|---|---|
| public final BooleanProperty autoHideProperty() | |
| bindOwnerFocusedProperty | back to summary |
|---|---|
| private void bindOwnerFocusedProperty(final Window ownerWindowValue) | |
| consumeAutoHidingEventsProperty | back to summary |
|---|---|
| public final BooleanProperty consumeAutoHidingEventsProperty() | |
| createInternalEventDispatcher | back to summary |
|---|---|
| pack-priv WindowEventDispatcher createInternalEventDispatcher() Overrides javafx.
| |
| doAutoHide | back to summary |
|---|---|
| pack-priv void doAutoHide() | |
| doVisibleChanged | back to summary |
|---|---|
| private void doVisibleChanged(boolean visible) | |
| doVisibleChanging | back to summary |
|---|---|
| private void doVisibleChanging(boolean visible) | |
| getAnchorBounds | back to summary |
|---|---|
| private Bounds getAnchorBounds() | |
| getAnchorLocation | back to summary |
|---|---|
| public final PopupWindow. | |
| getAnchorX | back to summary |
|---|---|
| public final double getAnchorX() | |
| getAnchorY | back to summary |
|---|---|
| public final double getAnchorY() | |
| getConsumeAutoHidingEvents | back to summary |
|---|---|
| public final boolean getConsumeAutoHidingEvents() | |
| getContent | back to summary |
|---|---|
| pack-priv ObservableList | |
| getExtendedBounds | back to summary |
|---|---|
| private Bounds getExtendedBounds() | |
| getOnAutoHide | back to summary |
|---|---|
| public final EventHandler | |
| getOwnerNode | back to summary |
|---|---|
| public final Node getOwnerNode() | |
| getOwnerWindow | back to summary |
|---|---|
| public final Window getOwnerWindow() | |
| getRootWindow | back to summary |
|---|---|
| private static Window getRootWindow(Window win) Gets the root (non PopupWindow) Window for the provided window.
| |
| getWindowOwner | back to summary |
|---|---|
| pack-priv Window getWindowOwner() Overrides javafx.
| |
| handleAutofixActivation | back to summary |
|---|---|
| private void handleAutofixActivation(final boolean visible, final boolean autofix) | |
| handleAutohideActivation | back to summary |
|---|---|
| private void handleAutohideActivation(final boolean visible, final boolean autohide) | |
| hide | back to summary |
|---|---|
| public void hide() Overrides javafx. Hide this Popup and all its children
| |
| hideOnEscapeProperty | back to summary |
|---|---|
| public final BooleanProperty hideOnEscapeProperty() | |
| isAutoFix | back to summary |
|---|---|
| public final boolean isAutoFix() | |
| isAutoHide | back to summary |
|---|---|
| public final boolean isAutoHide() | |
| isHideOnEscape | back to summary |
|---|---|
| public final boolean isHideOnEscape() | |
| notifyLocationChanged | back to summary |
|---|---|
| pack-priv void notifyLocationChanged(final double newX, final double newY) Overrides javafx. Doc from javafx. Notification from the windowing system that the window's position has changed.
| |
| onAutoHideProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| ownerNodeProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty | |
| ownerWindowProperty | back to summary |
|---|---|
| public final ReadOnlyObjectProperty | |
| setAnchorLocation | back to summary |
|---|---|
| public final void setAnchorLocation(final PopupWindow. | |
| setAnchorX | back to summary |
|---|---|
| public final void setAnchorX(final double value) | |
| setAnchorY | back to summary |
|---|---|
| public final void setAnchorY(final double value) | |
| setAutoFix | back to summary |
|---|---|
| public final void setAutoFix(boolean value) | |
| setAutoHide | back to summary |
|---|---|
| public final void setAutoHide(boolean value) | |
| setConsumeAutoHidingEvents | back to summary |
|---|---|
| public final void setConsumeAutoHidingEvents(boolean value) | |
| setHideOnEscape | back to summary |
|---|---|
| public final void setHideOnEscape(boolean value) | |
| setOnAutoHide | back to summary |
|---|---|
| public final void setOnAutoHide(EventHandler<Event> value) | |
| setScene | back to summary |
|---|---|
| protected final void setScene(Scene scene) Overrides javafx. 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. | |
| setXInternal | back to summary |
|---|---|
| pack-priv void setXInternal(final double value) Overrides javafx.
| |
| setYInternal | back to summary |
|---|---|
| pack-priv void setYInternal(final double value) Overrides javafx.
| |
| show | back to summary |
|---|---|
| public void show(Window owner) Show the popup.
| |
| show | back to summary |
|---|---|
| public void show(Node ownerNode, double anchorX, double anchorY) Shows the popup at the specified location on the screen. The popup window
is positioned in such way that its anchor point (
The popup is associated with the specified owner node. The
Note that when
| |
| show | back to summary |
|---|---|
| public void show(Window ownerWindow, double anchorX, double anchorY) Shows the popup at the specified location on the screen. The popup window
is positioned in such way that its anchor point (
| |
| showImpl | back to summary |
|---|---|
| private void showImpl(final Window owner) | |
| startMonitorOwnerEvents | back to summary |
|---|---|
| private void startMonitorOwnerEvents(final Window ownerWindowValue) | |
| stopMonitorOwnerEvents | back to summary |
|---|---|
| private void stopMonitorOwnerEvents(final Window ownerWindowValue) | |
| unbindOwnerFocusedProperty | back to summary |
|---|---|
| private void unbindOwnerFocusedProperty(final Window ownerWindowValue) | |
| union | back to summary |
|---|---|
| private Bounds union(final Bounds bounds1, final Bounds bounds2) | |
| updateWindow | back to summary |
|---|---|
| private void updateWindow(final double newAnchorX, final double newAnchorY) | |
| validateOwnerWindow | back to summary |
|---|---|
| private void validateOwnerWindow(final Window owner) | |
| windowToAnchorX | back to summary |
|---|---|
| private double windowToAnchorX(final double windowX) | |
| windowToAnchorY | back to summary |
|---|---|
| private double windowToAnchorY(final double windowY) | |
| wouldCreateCycle | back to summary |
|---|---|
| private static boolean wouldCreateCycle(Window parent, final Window child) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final PopupWindow. | CONTENT_BOTTOM_LEFT
Represents bottom left content corner. |
| public static final PopupWindow. | CONTENT_BOTTOM_RIGHT
Represents bottom right content corner. |
| public static final PopupWindow. | CONTENT_TOP_LEFT
Represents top left content corner. |
| public static final PopupWindow. | CONTENT_TOP_RIGHT
Represents top right content corner. |
| private final boolean | |
| public static final PopupWindow. | WINDOW_BOTTOM_LEFT
Represents bottom left window corner. |
| public static final PopupWindow. | WINDOW_BOTTOM_RIGHT
Represents bottom right window corner. |
| public static final PopupWindow. | WINDOW_TOP_LEFT
Represents top left window corner. |
| public static final PopupWindow. | WINDOW_TOP_RIGHT
Represents top right window corner. |
| private final double | |
| private final double |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv double | |
| pack-priv double | |
| pack-priv boolean | |
| public static PopupWindow. | |
| public static PopupWindow. |
| CONTENT_BOTTOM_LEFT | back to summary |
|---|---|
| public static final PopupWindow. Represents bottom left content corner. | |
| CONTENT_BOTTOM_RIGHT | back to summary |
|---|---|
| public static final PopupWindow. Represents bottom right content corner. | |
| CONTENT_TOP_LEFT | back to summary |
|---|---|
| public static final PopupWindow. Represents top left content corner. | |
| CONTENT_TOP_RIGHT | back to summary |
|---|---|
| public static final PopupWindow. Represents top right content corner. | |
| contentLocation | back to summary |
|---|---|
| private final boolean contentLocation | |
| WINDOW_BOTTOM_LEFT | back to summary |
|---|---|
| public static final PopupWindow. Represents bottom left window corner. | |
| WINDOW_BOTTOM_RIGHT | back to summary |
|---|---|
| public static final PopupWindow. Represents bottom right window corner. | |
| WINDOW_TOP_LEFT | back to summary |
|---|---|
| public static final PopupWindow. Represents top left window corner. | |
| WINDOW_TOP_RIGHT | back to summary |
|---|---|
| public static final PopupWindow. Represents top right window corner. | |
| xCoef | back to summary |
|---|---|
| private final double xCoef | |
| yCoef | back to summary |
|---|---|
| private final double yCoef | |
| AnchorLocation | back to summary |
|---|---|
| private AnchorLocation(final double xCoef, final double yCoef, final boolean contentLocation) | |
| getXCoef | back to summary |
|---|---|
| pack-priv double getXCoef() | |
| getYCoef | back to summary |
|---|---|
| pack-priv double getYCoef() | |
| isContentLocation | back to summary |
|---|---|
| pack-priv boolean isContentLocation() | |
| valueOf | back to summary |
|---|---|
| public static PopupWindow. | |
| values | back to summary |
|---|---|
| public static PopupWindow. | |
| Modifier and Type | Field and Description |
|---|---|
| private static final KeyCombination | |
| private final PopupWindow |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | |
| private void | |
| private void | |
| protected void | handleRedirectedEvent(final Object
the object from which the event has been redirected eventSource, final Event the event which has been redirected event)Overrides com. Called when a redirected event is received by this instance. |
| private boolean |
| ESCAPE_KEY_COMBINATION | back to summary |
|---|---|
| private static final KeyCombination ESCAPE_KEY_COMBINATION | |
| popupWindow | back to summary |
|---|---|
| private final PopupWindow popupWindow | |
| PopupEventRedirector | back to summary |
|---|---|
| public PopupEventRedirector(final PopupWindow popupWindow) | |
| handleAutoHidingEvents | back to summary |
|---|---|
| private void handleAutoHidingEvents(final Object eventSource, final Event event) | |
| handleEscapeKeyPressedEvent | back to summary |
|---|---|
| private void handleEscapeKeyPressedEvent(final Event event) | |
| handleFocusUngrabEvent | back to summary |
|---|---|
| private void handleFocusUngrabEvent() | |
| handleInputMethodEvent | back to summary |
|---|---|
| private void handleInputMethodEvent(final InputMethodEvent event) | |
| handleKeyEvent | back to summary |
|---|---|
| private void handleKeyEvent(final KeyEvent event) | |
| handleRedirectedEvent | back to summary |
|---|---|
| protected void handleRedirectedEvent(final Object eventSource, final Event event) Overrides com. Doc from com. Called when a redirected event is received by this instance. | |
| isOwnerNodeEvent | back to summary |
|---|---|
| private boolean isOwnerNodeEvent(final Event event) | |