public abstract class PopupWindow extends Window
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.
Modifier and Type | Class and Description |
---|---|
static class |
PopupWindow.AnchorLocation
Anchor location constants for popup anchor point selection.
|
impl_peer, peerListener
Constructor and Description |
---|
PopupWindow() |
Modifier and Type | Method and Description |
---|---|
ObjectProperty<PopupWindow.AnchorLocation> |
anchorLocationProperty() |
ReadOnlyDoubleProperty |
anchorXProperty() |
ReadOnlyDoubleProperty |
anchorYProperty() |
BooleanProperty |
autoFixProperty() |
BooleanProperty |
autoHideProperty() |
BooleanProperty |
consumeAutoHidingEventsProperty() |
PopupWindow.AnchorLocation |
getAnchorLocation() |
double |
getAnchorX() |
double |
getAnchorY() |
boolean |
getConsumeAutoHidingEvents() |
protected ObservableList<Node> |
getContent()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
EventHandler<Event> |
getOnAutoHide() |
Node |
getOwnerNode() |
Window |
getOwnerWindow() |
void |
hide()
Hide this Popup and all its children
|
BooleanProperty |
hideOnEscapeProperty() |
protected void |
impl_visibleChanged(boolean visible)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected void |
impl_visibleChanging(boolean visible)
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
boolean |
isAutoFix() |
boolean |
isAutoHide() |
boolean |
isHideOnEscape() |
ObjectProperty<EventHandler<Event>> |
onAutoHideProperty() |
ReadOnlyObjectProperty<Node> |
ownerNodeProperty() |
ReadOnlyObjectProperty<Window> |
ownerWindowProperty() |
void |
setAnchorLocation(PopupWindow.AnchorLocation value) |
void |
setAnchorX(double value) |
void |
setAnchorY(double value) |
void |
setAutoFix(boolean value) |
void |
setAutoHide(boolean value) |
void |
setConsumeAutoHidingEvents(boolean value) |
void |
setHideOnEscape(boolean value) |
void |
setOnAutoHide(EventHandler<Event> value) |
protected void |
setScene(Scene scene)
Note to subclasses: the scene used by PopupWindow is very specifically
managed by PopupWindow.
|
void |
show(Node ownerNode,
double anchorX,
double anchorY)
Shows the popup at the specified location on the screen.
|
void |
show(Window owner)
Show the popup.
|
void |
show(Window ownerWindow,
double anchorX,
double anchorY)
Shows the popup at the specified location on the screen.
|
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getProperties, getScene, getUserData, getWidth, getX, getY, hasProperties, heightProperty, impl_getMXWindowType, impl_getPeer, impl_getWindows, isFocused, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, removeEventFilter, removeEventHandler, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setFocused, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setUserData, setWidth, setX, setY, show, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
@Deprecated protected ObservableList<Node> getContent()
public final Window getOwnerWindow()
public final ReadOnlyObjectProperty<Window> ownerWindowProperty()
public final Node getOwnerNode()
public final ReadOnlyObjectProperty<Node> ownerNodeProperty()
protected final void setScene(Scene scene)
public final void setAutoFix(boolean value)
public final boolean isAutoFix()
public final BooleanProperty autoFixProperty()
public final void setAutoHide(boolean value)
public final boolean isAutoHide()
public final BooleanProperty autoHideProperty()
public final void setOnAutoHide(EventHandler<Event> value)
public final EventHandler<Event> getOnAutoHide()
public final ObjectProperty<EventHandler<Event>> onAutoHideProperty()
public final void setHideOnEscape(boolean value)
public final boolean isHideOnEscape()
public final BooleanProperty hideOnEscapeProperty()
public final void setConsumeAutoHidingEvents(boolean value)
public final boolean getConsumeAutoHidingEvents()
public final BooleanProperty consumeAutoHidingEventsProperty()
public void show(Window owner)
owner
- The owner of the popup. This must not be null.NullPointerException
- if owner is nullIllegalArgumentException
- if the specified owner window would
create cycle in the window hierarchypublic void show(Node ownerNode, double anchorX, double anchorY)
anchorLocation
)
is displayed at the specified anchorX
and anchorY
coordinates.
The popup is associated with the specified owner node. The Window
which 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.
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 coordinatesNullPointerException
- 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 hierarchypublic void show(Window ownerWindow, double anchorX, double anchorY)
anchorLocation
)
is displayed at the specified anchorX
and anchorY
coordinates.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 coordinatesNullPointerException
- if ownerWindow is nullIllegalArgumentException
- if the specified owner window would
create cycle in the window hierarchy@Deprecated protected void impl_visibleChanging(boolean visible)
Window
impl_visibleChanging
in class Window
@Deprecated protected void impl_visibleChanged(boolean visible)
Window
impl_visibleChanged
in class Window
public final void setAnchorX(double value)
public final double getAnchorX()
public final ReadOnlyDoubleProperty anchorXProperty()
public final void setAnchorY(double value)
public final double getAnchorY()
public final ReadOnlyDoubleProperty anchorYProperty()
public final void setAnchorLocation(PopupWindow.AnchorLocation value)
public final PopupWindow.AnchorLocation getAnchorLocation()
public final ObjectProperty<PopupWindow.AnchorLocation> anchorLocationProperty()
Copyright © 2020. All rights reserved.