public class Window extends Object implements EventTarget
A top level window within which a scene is hosted, and with which the user
interacts. A Window might be a Stage
, PopupWindow
, or other
such top level. A Window is used also for browser plug-in based deployments.
Modifier and Type | Field and Description |
---|---|
protected TKStage |
impl_peer
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
protected WindowPeerListener |
peerListener
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
Modifier | Constructor and Description |
---|---|
protected |
Window() |
Modifier and Type | Method and Description |
---|---|
<T extends Event> |
addEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Registers an event filter to this node.
|
<T extends Event> |
addEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Registers an event handler to this node.
|
EventDispatchChain |
buildEventDispatchChain(EventDispatchChain tail)
Construct an event dispatch chain for this window.
|
void |
centerOnScreen()
Sets x and y properties on this Window so that it is centered on the
curent screen.
|
ObjectProperty<EventDispatcher> |
eventDispatcherProperty() |
void |
fireEvent(Event event)
Fires the specified event.
|
ReadOnlyBooleanProperty |
focusedProperty() |
EventDispatcher |
getEventDispatcher() |
double |
getHeight() |
EventHandler<WindowEvent> |
getOnCloseRequest() |
EventHandler<WindowEvent> |
getOnHidden() |
EventHandler<WindowEvent> |
getOnHiding() |
EventHandler<WindowEvent> |
getOnShowing() |
EventHandler<WindowEvent> |
getOnShown() |
double |
getOpacity() |
ObservableMap<Object,Object> |
getProperties()
Returns an observable map of properties on this node for use primarily
by application developers.
|
Scene |
getScene() |
Object |
getUserData()
Returns a previously set Object property, or null if no such property
has been set using the
setUserData(java.lang.Object) method. |
double |
getWidth() |
double |
getX() |
double |
getY() |
boolean |
hasProperties()
Tests if Window has properties.
|
ReadOnlyDoubleProperty |
heightProperty() |
void |
hide()
Attempts to hide this Window by setting the visibility to false.
|
String |
impl_getMXWindowType()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
TKStage |
impl_getPeer()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
static Iterator<Window> |
impl_getWindows()
Deprecated.
This is an internal API that is not intended for use and will be removed in the next version
|
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 |
isFocused() |
boolean |
isShowing() |
ObjectProperty<EventHandler<WindowEvent>> |
onCloseRequestProperty() |
ObjectProperty<EventHandler<WindowEvent>> |
onHiddenProperty() |
ObjectProperty<EventHandler<WindowEvent>> |
onHidingProperty() |
ObjectProperty<EventHandler<WindowEvent>> |
onShowingProperty() |
ObjectProperty<EventHandler<WindowEvent>> |
onShownProperty() |
DoubleProperty |
opacityProperty() |
<T extends Event> |
removeEventFilter(EventType<T> eventType,
EventHandler<? super T> eventFilter)
Unregisters a previously registered event filter from this node.
|
<T extends Event> |
removeEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Unregisters a previously registered event handler from this node.
|
void |
requestFocus()
Requests that this
Window get the input focus. |
ReadOnlyObjectProperty<Scene> |
sceneProperty() |
void |
setEventDispatcher(EventDispatcher value) |
protected <T extends Event> |
setEventHandler(EventType<T> eventType,
EventHandler<? super T> eventHandler)
Sets the handler to use for this event type.
|
void |
setFocused(boolean value)
Deprecated.
|
void |
setHeight(double value) |
void |
setOnCloseRequest(EventHandler<WindowEvent> value) |
void |
setOnHidden(EventHandler<WindowEvent> value) |
void |
setOnHiding(EventHandler<WindowEvent> value) |
void |
setOnShowing(EventHandler<WindowEvent> value) |
void |
setOnShown(EventHandler<WindowEvent> value) |
void |
setOpacity(double value) |
protected void |
setScene(Scene value) |
void |
setUserData(Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
void |
setWidth(double value) |
void |
setX(double value) |
void |
setY(double value) |
protected void |
show()
Attempts to show this Window by setting visibility to true
|
ReadOnlyBooleanProperty |
showingProperty() |
void |
sizeToScene()
Set the width and height of this Window to match the size of the content
of this Window's Scene.
|
ReadOnlyDoubleProperty |
widthProperty() |
ReadOnlyDoubleProperty |
xProperty() |
ReadOnlyDoubleProperty |
yProperty() |
@Deprecated protected WindowPeerListener peerListener
@Deprecated protected volatile TKStage impl_peer
@Deprecated public static Iterator<Window> impl_getWindows()
@Deprecated public TKStage impl_getPeer()
@Deprecated public String impl_getMXWindowType()
public void sizeToScene()
public void centerOnScreen()
public final void setX(double value)
public final double getX()
public final ReadOnlyDoubleProperty xProperty()
public final void setY(double value)
public final double getY()
public final ReadOnlyDoubleProperty yProperty()
public final void setWidth(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
public final void setHeight(double value)
public final double getHeight()
public final ReadOnlyDoubleProperty heightProperty()
@Deprecated public final void setFocused(boolean value)
public final void requestFocus()
Window
get the input focus.public final boolean isFocused()
public final ReadOnlyBooleanProperty focusedProperty()
public final ObservableMap<Object,Object> getProperties()
public boolean hasProperties()
public void setUserData(Object value)
getUserData()
.value
- The value to be stored - this can later be retrieved by calling
getUserData()
.public Object getUserData()
setUserData(java.lang.Object)
method.protected void setScene(Scene value)
public final Scene getScene()
public final ReadOnlyObjectProperty<Scene> sceneProperty()
public final void setOpacity(double value)
public final double getOpacity()
public final DoubleProperty opacityProperty()
public final void setOnCloseRequest(EventHandler<WindowEvent> value)
public final EventHandler<WindowEvent> getOnCloseRequest()
public final ObjectProperty<EventHandler<WindowEvent>> onCloseRequestProperty()
public final void setOnShowing(EventHandler<WindowEvent> value)
public final EventHandler<WindowEvent> getOnShowing()
public final ObjectProperty<EventHandler<WindowEvent>> onShowingProperty()
public final void setOnShown(EventHandler<WindowEvent> value)
public final EventHandler<WindowEvent> getOnShown()
public final ObjectProperty<EventHandler<WindowEvent>> onShownProperty()
public final void setOnHiding(EventHandler<WindowEvent> value)
public final EventHandler<WindowEvent> getOnHiding()
public final ObjectProperty<EventHandler<WindowEvent>> onHidingProperty()
public final void setOnHidden(EventHandler<WindowEvent> value)
public final EventHandler<WindowEvent> getOnHidden()
public final ObjectProperty<EventHandler<WindowEvent>> onHiddenProperty()
public final boolean isShowing()
public final ReadOnlyBooleanProperty showingProperty()
protected void show()
IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.public void hide()
IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.@Deprecated protected void impl_visibleChanging(boolean visible)
@Deprecated protected void impl_visibleChanged(boolean visible)
public final void setEventDispatcher(EventDispatcher value)
public final EventDispatcher getEventDispatcher()
public final ObjectProperty<EventDispatcher> eventDispatcherProperty()
public final <T extends Event> void addEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
Event
of the specified type during the bubbling
phase of event delivery.T
- the specific event class of the handlereventType
- the type of the events to receive by the handlereventHandler
- the handler to registerNullPointerException
- if the event type or handler is nullpublic final <T extends Event> void removeEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
T
- the specific event class of the handlereventType
- the event type from which to unregistereventHandler
- the handler to unregisterNullPointerException
- if the event type or handler is nullpublic final <T extends Event> void addEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
Event
of the specified type during the capturing
phase of event delivery.T
- the specific event class of the filtereventType
- the type of the events to receive by the filtereventFilter
- the filter to registerNullPointerException
- if the event type or filter is nullpublic final <T extends Event> void removeEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
T
- the specific event class of the filtereventType
- the event type from which to unregistereventFilter
- the filter to unregisterNullPointerException
- if the event type or filter is nullprotected final <T extends Event> void setEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
T
- the specific event class of the handlereventType
- the event type to associate with the given eventHandlereventHandler
- the handler to register, or null to unregisterNullPointerException
- if the event type is nullpublic final void fireEvent(Event event)
This method must be called on the FX user thread.
event
- the event to firepublic EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
buildEventDispatchChain
in interface EventTarget
tail
- the initial chain to build fromCopyright © 2020. All rights reserved.