- All Implemented Interfaces:
- EventTarget
- Direct Known Subclasses:
- PopupWindow,- Stage
public class Window extends Object implements EventTarget
Stage, PopupWindow, or other
 such top level window.
 Window objects must be constructed and modified on the JavaFX Application Thread.
 The JavaFX Application Thread is created as part of the startup process for
 the JavaFX runtime. See the Application class and
 the Platform.startup(Runnable) method for more information.
 
- Since:
- JavaFX 2.0
- 
Property SummaryProperties Type Property Description ObjectProperty<EventDispatcher>eventDispatcherSpecifies the event dispatcher for this node.ReadOnlyBooleanPropertyfocusedWhether or not thisWindowhas the keyboard or input focus.BooleanPropertyforceIntegerRenderScaleBoolean property that controls whether only integer render scales are set by default by the system when there is a change in the associated output scale.ReadOnlyDoublePropertyheightThe height of thisWindow.ObjectProperty<EventHandler<WindowEvent>>onCloseRequestCalled when there is an external request to close thisWindow.ObjectProperty<EventHandler<WindowEvent>>onHiddenCalled just after the Window has been hidden.ObjectProperty<EventHandler<WindowEvent>>onHidingCalled just prior to the Window being hidden.ObjectProperty<EventHandler<WindowEvent>>onShowingCalled just prior to the Window being shown.ObjectProperty<EventHandler<WindowEvent>>onShownCalled just after the Window is shown.DoublePropertyopacityDefines the opacity of theWindowas a value between 0.0 and 1.0.ReadOnlyDoublePropertyoutputScaleXThe scale that theWindowwill apply to horizontal scene coordinates in all stages of rendering and compositing the output to the screen or other destination device.ReadOnlyDoublePropertyoutputScaleYThe scale that theWindowwill apply to vertical scene coordinates in all stages of rendering and compositing the output to the screen or other destination device.DoublePropertyrenderScaleXThe horizontal scale that theWindowwill use when rendering itsSceneto the rendering buffer.DoublePropertyrenderScaleYThe vertical scale that theWindowwill use when rendering itsSceneto the rendering buffer.ReadOnlyObjectProperty<Scene>sceneTheSceneto be rendered on thisWindow.ReadOnlyBooleanPropertyshowingWhether or not thisWindowis showing (that is, open on the user's system).ReadOnlyDoublePropertywidthThe width of thisWindow.ReadOnlyDoublePropertyxThe horizontal location of thisWindowon the screen.ReadOnlyDoublePropertyyThe vertical location of thisWindowon the screen.
- 
Constructor SummaryConstructors Modifier Constructor Description protectedWindow()
- 
Method SummaryModifier and Type Method Description <T extends Event>
 voidaddEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)Registers an event filter to this node.<T extends Event>
 voidaddEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Registers an event handler to this node.EventDispatchChainbuildEventDispatchChain(EventDispatchChain tail)Construct an event dispatch chain for this window.voidcenterOnScreen()Sets x and y properties on this Window so that it is centered on the curent screen.ObjectProperty<EventDispatcher>eventDispatcherProperty()Specifies the event dispatcher for this node.voidfireEvent(Event event)Fires the specified event.ReadOnlyBooleanPropertyfocusedProperty()Whether or not thisWindowhas the keyboard or input focus.BooleanPropertyforceIntegerRenderScaleProperty()Boolean property that controls whether only integer render scales are set by default by the system when there is a change in the associated output scale.EventDispatchergetEventDispatcher()Gets the value of the property eventDispatcher.doublegetHeight()Gets the value of the property height.EventHandler<WindowEvent>getOnCloseRequest()Gets the value of the property onCloseRequest.EventHandler<WindowEvent>getOnHidden()Gets the value of the property onHidden.EventHandler<WindowEvent>getOnHiding()Gets the value of the property onHiding.EventHandler<WindowEvent>getOnShowing()Gets the value of the property onShowing.EventHandler<WindowEvent>getOnShown()Gets the value of the property onShown.doublegetOpacity()Gets the value of the property opacity.doublegetOutputScaleX()Gets the value of the property outputScaleX.doublegetOutputScaleY()Gets the value of the property outputScaleY.ObservableMap<Object,Object>getProperties()Returns an observable map of properties on this node for use primarily by application developers.doublegetRenderScaleX()Gets the value of the property renderScaleX.doublegetRenderScaleY()Gets the value of the property renderScaleY.ScenegetScene()Gets the value of the property scene.ObjectgetUserData()Returns a previously set Object property, or null if no such property has been set using thesetUserData(java.lang.Object)method.doublegetWidth()Gets the value of the property width.static ObservableList<Window>getWindows()Returns a list containing a reference to the currently showing JavaFX windows.doublegetX()Gets the value of the property x.doublegetY()Gets the value of the property y.booleanhasProperties()Tests if Window has properties.ReadOnlyDoublePropertyheightProperty()The height of thisWindow.voidhide()Attempts to hide this Window by setting the visibility to false.booleanisFocused()Gets the value of the property focused.booleanisForceIntegerRenderScale()Gets the value of the property forceIntegerRenderScale.booleanisShowing()Gets the value of the property showing.ObjectProperty<EventHandler<WindowEvent>>onCloseRequestProperty()Called when there is an external request to close thisWindow.ObjectProperty<EventHandler<WindowEvent>>onHiddenProperty()Called just after the Window has been hidden.ObjectProperty<EventHandler<WindowEvent>>onHidingProperty()Called just prior to the Window being hidden.ObjectProperty<EventHandler<WindowEvent>>onShowingProperty()Called just prior to the Window being shown.ObjectProperty<EventHandler<WindowEvent>>onShownProperty()Called just after the Window is shown.DoublePropertyopacityProperty()Defines the opacity of theWindowas a value between 0.0 and 1.0.ReadOnlyDoublePropertyoutputScaleXProperty()The scale that theWindowwill apply to horizontal scene coordinates in all stages of rendering and compositing the output to the screen or other destination device.ReadOnlyDoublePropertyoutputScaleYProperty()The scale that theWindowwill apply to vertical scene coordinates in all stages of rendering and compositing the output to the screen or other destination device.<T extends Event>
 voidremoveEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)Unregisters a previously registered event filter from this node.<T extends Event>
 voidremoveEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Unregisters a previously registered event handler from this node.DoublePropertyrenderScaleXProperty()The horizontal scale that theWindowwill use when rendering itsSceneto the rendering buffer.DoublePropertyrenderScaleYProperty()The vertical scale that theWindowwill use when rendering itsSceneto the rendering buffer.voidrequestFocus()Requests that thisWindowget the input focus.ReadOnlyObjectProperty<Scene>sceneProperty()TheSceneto be rendered on thisWindow.voidsetEventDispatcher(EventDispatcher value)Sets the value of the property eventDispatcher.protected <T extends Event>
 voidsetEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Sets the handler to use for this event type.voidsetForceIntegerRenderScale(boolean forced)Sets the value of the property forceIntegerRenderScale.voidsetHeight(double value)Sets the value of the property height.voidsetOnCloseRequest(EventHandler<WindowEvent> value)Sets the value of the property onCloseRequest.voidsetOnHidden(EventHandler<WindowEvent> value)Sets the value of the property onHidden.voidsetOnHiding(EventHandler<WindowEvent> value)Sets the value of the property onHiding.voidsetOnShowing(EventHandler<WindowEvent> value)Sets the value of the property onShowing.voidsetOnShown(EventHandler<WindowEvent> value)Sets the value of the property onShown.voidsetOpacity(double value)Sets the value of the property opacity.voidsetRenderScaleX(double scale)Sets the value of the property renderScaleX.voidsetRenderScaleY(double scale)Sets the value of the property renderScaleY.protected voidsetScene(Scene value)Sets the value of the property scene.voidsetUserData(Object value)Convenience method for setting a single Object property that can be retrieved at a later date.voidsetWidth(double value)Sets the value of the property width.voidsetX(double value)Sets the value of the property x.voidsetY(double value)Sets the value of the property y.protected voidshow()Attempts to show this Window by setting visibility to trueReadOnlyBooleanPropertyshowingProperty()Whether or not thisWindowis showing (that is, open on the user's system).voidsizeToScene()Set the width and height of this Window to match the size of the content of this Window's Scene.ReadOnlyDoublePropertywidthProperty()The width of thisWindow.ReadOnlyDoublePropertyxProperty()The horizontal location of thisWindowon the screen.ReadOnlyDoublePropertyyProperty()The vertical location of thisWindowon the screen.
- 
Property Details- 
outputScaleXThe scale that theWindowwill apply to horizontal scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 - Since:
- 9
- See Also:
- getOutputScaleX()
 
- 
outputScaleYThe scale that theWindowwill apply to vertical scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 - Since:
- 9
- See Also:
- getOutputScaleY()
 
- 
forceIntegerRenderScaleBoolean property that controls whether only integer render scales are set by default by the system when there is a change in the associated output scale. TherenderScaleproperties will be updated directly and simultaneously with any changes in the associatedoutputScaleproperties, but the values can be overridden by subsequent calls to thesetRenderScalesetters or through appropriate use of binding. This property will not prevent setting non-integer scales directly using therenderScaleproperty object or the convenience setter method.- Default value:
- false
- Since:
- 9
- See Also:
- isForceIntegerRenderScale(),- setForceIntegerRenderScale(boolean)
 
- 
renderScaleXThe horizontal scale that theWindowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleXproperty and can be overridden either by callingsetRenderScaleX()in response to a listener on theoutputScaleXproperty or by binding it appropriately.- Default value:
- outputScaleX
- Since:
- 9
- See Also:
- getRenderScaleX(),- setRenderScaleX(double)
 
- 
renderScaleYThe vertical scale that theWindowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleYproperty and can be overridden either by callingsetRenderScaleY()in response to a listener on theoutputScaleYproperty or by binding it appropriately.- Default value:
- outputScaleY
- Since:
- 9
- See Also:
- getRenderScaleY(),- setRenderScaleY(double)
 
- 
xThe horizontal location of thisWindowon the screen. Changing this attribute will move theWindowhorizontally. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.- See Also:
- getX(),- setX(double)
 
- 
yThe vertical location of thisWindowon the screen. Changing this attribute will move theWindowvertically. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.- See Also:
- getY(),- setY(double)
 
- 
widthThe width of thisWindow. Changing this attribute will narrow or widen the width of theWindow. This value includes any and all decorations which may be added by the Operating System such as resizable frame handles. Typical applications will set theScenewidth instead. ThisWindowwill take its width from the scene if it has never been set by the application. Resizing the window by end user does not count as a setting the width by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- getWidth(),- setWidth(double)
 
- 
heightThe height of thisWindow. Changing this attribute will shrink or heighten the height of theWindow. This value includes any and all decorations which may be added by the Operating System such as the title bar. Typical applications will set theSceneheight instead. This window will take its height from the scene if it has never been set by the application. Resizing this window by end user does not count as a setting the height by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- getHeight(),- setHeight(double)
 
- 
focusedWhether or not thisWindowhas the keyboard or input focus.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- isFocused()
 
- 
sceneTheSceneto be rendered on thisWindow. There can only be oneSceneon theWindowat a time, and aScenecan only be on oneWindowat a time. Setting aSceneon a differentWindowwill cause the oldWindowto lose the reference before the new one gains it. You may swapScenes on aWindowat any time, even if it is an instance ofStageand withfullScreenset to true. If the width or height of thisWindowhave never been set by the application, setting the scene will cause thisWindowto take its width or height from that scene. Resizing this window by end user does not count as setting the width or height by the application. AnIllegalStateExceptionis thrown if this property is set on a thread other than the JavaFX Application Thread.- Default value:
- null
- See Also:
- getScene(),- setScene(Scene)
 
- 
opacityDefines the opacity of theWindowas a value between 0.0 and 1.0. The opacity is reflected across theWindow, itsDecorationand itsScenecontent. On a JavaFX runtime platform that does not support opacity, assigning a value to this variable will have no visible difference. AWindowwith 0% opacity is fully translucent. Typically, aWindowwith 0% opacity will not receive any mouse events.- Default value:
- 1.0
- See Also:
- getOpacity(),- setOpacity(double)
 
- 
onCloseRequestCalled when there is an external request to close thisWindow. The installed event handler can prevent window closing by consuming the received event.
- 
onShowingCalled just prior to the Window being shown.- See Also:
- getOnShowing(),- setOnShowing(EventHandler)
 
- 
onShownCalled just after the Window is shown.- See Also:
- getOnShown(),- setOnShown(EventHandler)
 
- 
onHidingCalled just prior to the Window being hidden.- See Also:
- getOnHiding(),- setOnHiding(EventHandler)
 
- 
onHiddenCalled just after the Window has been hidden. When theWindowis hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when theWindowis closed.- See Also:
- getOnHidden(),- setOnHidden(EventHandler)
 
- 
showingWhether or not thisWindowis showing (that is, open on the user's system). The Window might be "showing", yet the user might not be able to see it due to the Window being rendered behind another Window or due to the Window being positioned off the monitor.- Default value:
- false
- See Also:
- isShowing()
 
- 
eventDispatcherSpecifies the event dispatcher for this node. The default event dispatcher sends the received events to the registered event handlers and filters. When replacing the value with a newEventDispatcher, the new dispatcher should forward events to the replaced dispatcher to maintain the node's default event handling behavior.
 
- 
- 
Constructor Details- 
Windowprotected Window()
 
- 
- 
Method Details- 
getWindowsReturns a list containing a reference to the currently showing JavaFX windows. The list is unmodifiable - attempting to modify this list will result in anUnsupportedOperationExceptionbeing thrown at runtime.- Returns:
- A list containing all windows that are currently showing.
- Since:
- 9
 
- 
sizeToScenepublic void sizeToScene()Set the width and height of this Window to match the size of the content of this Window's Scene.
- 
centerOnScreenpublic void centerOnScreen()Sets x and y properties on this Window so that it is centered on the curent screen. The current screen is determined from the intersection of current window bounds and visual bounds of all screens.
- 
getOutputScaleXpublic final double getOutputScaleX()Gets the value of the property outputScaleX.- Property description:
- The scale that the Windowwill apply to horizontal scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 
- Since:
- 9
 
- 
outputScaleXPropertyThe scale that theWindowwill apply to horizontal scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 - Since:
- 9
- See Also:
- getOutputScaleX()
 
- 
getOutputScaleYpublic final double getOutputScaleY()Gets the value of the property outputScaleY.- Property description:
- The scale that the Windowwill apply to vertical scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 
- Since:
- 9
 
- 
outputScaleYPropertyThe scale that theWindowwill apply to vertical scene coordinates in all stages of rendering and compositing the output to the screen or other destination device. This property is updated asynchronously by the system at various times including:- Window creation
- At some point during moving a window to a new Screenwhich may be before or after theScreenproperty is updated.
- In response to a change in user preferences for output scaling.
 - Since:
- 9
- See Also:
- getOutputScaleY()
 
- 
setForceIntegerRenderScalepublic final void setForceIntegerRenderScale(boolean forced)Sets the value of the property forceIntegerRenderScale.- Property description:
- Boolean property that controls whether only integer render scales
 are set by default by the system when there is a change in the
 associated output scale.
 The renderScaleproperties will be updated directly and simultaneously with any changes in the associatedoutputScaleproperties, but the values can be overridden by subsequent calls to thesetRenderScalesetters or through appropriate use of binding. This property will not prevent setting non-integer scales directly using therenderScaleproperty object or the convenience setter method.
- Default value:
- false
- Since:
- 9
 
- 
isForceIntegerRenderScalepublic final boolean isForceIntegerRenderScale()Gets the value of the property forceIntegerRenderScale.- Property description:
- Boolean property that controls whether only integer render scales
 are set by default by the system when there is a change in the
 associated output scale.
 The renderScaleproperties will be updated directly and simultaneously with any changes in the associatedoutputScaleproperties, but the values can be overridden by subsequent calls to thesetRenderScalesetters or through appropriate use of binding. This property will not prevent setting non-integer scales directly using therenderScaleproperty object or the convenience setter method.
- Default value:
- false
- Since:
- 9
 
- 
forceIntegerRenderScalePropertyBoolean property that controls whether only integer render scales are set by default by the system when there is a change in the associated output scale. TherenderScaleproperties will be updated directly and simultaneously with any changes in the associatedoutputScaleproperties, but the values can be overridden by subsequent calls to thesetRenderScalesetters or through appropriate use of binding. This property will not prevent setting non-integer scales directly using therenderScaleproperty object or the convenience setter method.- Default value:
- false
- Since:
- 9
- See Also:
- isForceIntegerRenderScale(),- setForceIntegerRenderScale(boolean)
 
- 
setRenderScaleXpublic final void setRenderScaleX(double scale)Sets the value of the property renderScaleX.- Property description:
- The horizontal scale that the Windowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleXproperty and can be overridden either by callingsetRenderScaleX()in response to a listener on theoutputScaleXproperty or by binding it appropriately.
- Default value:
- outputScaleX
- Since:
- 9
 
- 
getRenderScaleXpublic final double getRenderScaleX()Gets the value of the property renderScaleX.- Property description:
- The horizontal scale that the Windowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleXproperty and can be overridden either by callingsetRenderScaleX()in response to a listener on theoutputScaleXproperty or by binding it appropriately.
- Default value:
- outputScaleX
- Since:
- 9
 
- 
renderScaleXPropertyThe horizontal scale that theWindowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleXproperty and can be overridden either by callingsetRenderScaleX()in response to a listener on theoutputScaleXproperty or by binding it appropriately.- Default value:
- outputScaleX
- Since:
- 9
- See Also:
- getRenderScaleX(),- setRenderScaleX(double)
 
- 
setRenderScaleYpublic final void setRenderScaleY(double scale)Sets the value of the property renderScaleY.- Property description:
- The vertical scale that the Windowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleYproperty and can be overridden either by callingsetRenderScaleY()in response to a listener on theoutputScaleYproperty or by binding it appropriately.
- Default value:
- outputScaleY
- Since:
- 9
 
- 
getRenderScaleYpublic final double getRenderScaleY()Gets the value of the property renderScaleY.- Property description:
- The vertical scale that the Windowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleYproperty and can be overridden either by callingsetRenderScaleY()in response to a listener on theoutputScaleYproperty or by binding it appropriately.
- Default value:
- outputScaleY
- Since:
- 9
 
- 
renderScaleYPropertyThe vertical scale that theWindowwill use when rendering itsSceneto the rendering buffer. This property is automatically updated whenever there is a change in theoutputScaleYproperty and can be overridden either by callingsetRenderScaleY()in response to a listener on theoutputScaleYproperty or by binding it appropriately.- Default value:
- outputScaleY
- Since:
- 9
- See Also:
- getRenderScaleY(),- setRenderScaleY(double)
 
- 
setXpublic final void setX(double value)Sets the value of the property x.- Property description:
- The horizontal location of this Windowon the screen. Changing this attribute will move theWindowhorizontally. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.
 
- 
getXpublic final double getX()Gets the value of the property x.- Property description:
- The horizontal location of this Windowon the screen. Changing this attribute will move theWindowhorizontally. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.
 
- 
xPropertyThe horizontal location of thisWindowon the screen. Changing this attribute will move theWindowhorizontally. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.- See Also:
- getX(),- setX(double)
 
- 
setYpublic final void setY(double value)Sets the value of the property y.- Property description:
- The vertical location of this Windowon the screen. Changing this attribute will move theWindowvertically. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.
 
- 
getYpublic final double getY()Gets the value of the property y.- Property description:
- The vertical location of this Windowon the screen. Changing this attribute will move theWindowvertically. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.
 
- 
yPropertyThe vertical location of thisWindowon the screen. Changing this attribute will move theWindowvertically. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.- See Also:
- getY(),- setY(double)
 
- 
setWidthpublic final void setWidth(double value)Sets the value of the property width.- Property description:
- The width of this Window. Changing this attribute will narrow or widen the width of theWindow. This value includes any and all decorations which may be added by the Operating System such as resizable frame handles. Typical applications will set theScenewidth instead. ThisWindowwill take its width from the scene if it has never been set by the application. Resizing the window by end user does not count as a setting the width by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. 
 
- 
getWidthpublic final double getWidth()Gets the value of the property width.- Property description:
- The width of this Window. Changing this attribute will narrow or widen the width of theWindow. This value includes any and all decorations which may be added by the Operating System such as resizable frame handles. Typical applications will set theScenewidth instead. ThisWindowwill take its width from the scene if it has never been set by the application. Resizing the window by end user does not count as a setting the width by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. 
 
- 
widthPropertyThe width of thisWindow. Changing this attribute will narrow or widen the width of theWindow. This value includes any and all decorations which may be added by the Operating System such as resizable frame handles. Typical applications will set theScenewidth instead. ThisWindowwill take its width from the scene if it has never been set by the application. Resizing the window by end user does not count as a setting the width by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- getWidth(),- setWidth(double)
 
- 
setHeightpublic final void setHeight(double value)Sets the value of the property height.- Property description:
- The height of this Window. Changing this attribute will shrink or heighten the height of theWindow. This value includes any and all decorations which may be added by the Operating System such as the title bar. Typical applications will set theSceneheight instead. This window will take its height from the scene if it has never been set by the application. Resizing this window by end user does not count as a setting the height by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. 
 
- 
getHeightpublic final double getHeight()Gets the value of the property height.- Property description:
- The height of this Window. Changing this attribute will shrink or heighten the height of theWindow. This value includes any and all decorations which may be added by the Operating System such as the title bar. Typical applications will set theSceneheight instead. This window will take its height from the scene if it has never been set by the application. Resizing this window by end user does not count as a setting the height by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. 
 
- 
heightPropertyThe height of thisWindow. Changing this attribute will shrink or heighten the height of theWindow. This value includes any and all decorations which may be added by the Operating System such as the title bar. Typical applications will set theSceneheight instead. This window will take its height from the scene if it has never been set by the application. Resizing this window by end user does not count as a setting the height by the application. If thisWindowis an instance ofStage, changing this attribute will not visually affect theWindowwhilefullScreenis true, but will be honored by theWindowoncefullScreenbecomes false.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- getHeight(),- setHeight(double)
 
- 
requestFocuspublic final void requestFocus()Requests that thisWindowget the input focus.
- 
isFocusedpublic final boolean isFocused()Gets the value of the property focused.- Property description:
- Whether or not this Windowhas the keyboard or input focus.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. 
 
- 
focusedPropertyWhether or not thisWindowhas the keyboard or input focus.The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable. - See Also:
- isFocused()
 
- 
getPropertiesReturns an observable map of properties on this node for use primarily by application developers.- Returns:
- an observable map of properties on this node for use primarily by application developers
- Since:
- JavaFX 8u40
 
- 
hasPropertiespublic boolean hasProperties()Tests if Window has properties.- Returns:
- true if node has properties.
- Since:
- JavaFX 8u40
 
- 
setUserDataConvenience method for setting a single Object property that can be retrieved at a later date. This is functionally equivalent to calling the getProperties().put(Object key, Object value) method. This can later be retrieved by callinggetUserData().- Parameters:
- value- The value to be stored - this can later be retrieved by calling- getUserData().
- Since:
- JavaFX 8u40
 
- 
getUserDataReturns a previously set Object property, or null if no such property has been set using thesetUserData(java.lang.Object)method.- Returns:
- The Object that was previously set, or null if no property has been set or if null was set.
- Since:
- JavaFX 8u40
 
- 
setSceneSets the value of the property scene.- Property description:
- The Sceneto be rendered on thisWindow. There can only be oneSceneon theWindowat a time, and aScenecan only be on oneWindowat a time. Setting aSceneon a differentWindowwill cause the oldWindowto lose the reference before the new one gains it. You may swapScenes on aWindowat any time, even if it is an instance ofStageand withfullScreenset to true. If the width or height of thisWindowhave never been set by the application, setting the scene will cause thisWindowto take its width or height from that scene. Resizing this window by end user does not count as setting the width or height by the application. AnIllegalStateExceptionis thrown if this property is set on a thread other than the JavaFX Application Thread.
- Default value:
- null
 
- 
getSceneGets the value of the property scene.- Property description:
- The Sceneto be rendered on thisWindow. There can only be oneSceneon theWindowat a time, and aScenecan only be on oneWindowat a time. Setting aSceneon a differentWindowwill cause the oldWindowto lose the reference before the new one gains it. You may swapScenes on aWindowat any time, even if it is an instance ofStageand withfullScreenset to true. If the width or height of thisWindowhave never been set by the application, setting the scene will cause thisWindowto take its width or height from that scene. Resizing this window by end user does not count as setting the width or height by the application. AnIllegalStateExceptionis thrown if this property is set on a thread other than the JavaFX Application Thread.
- Default value:
- null
 
- 
scenePropertyTheSceneto be rendered on thisWindow. There can only be oneSceneon theWindowat a time, and aScenecan only be on oneWindowat a time. Setting aSceneon a differentWindowwill cause the oldWindowto lose the reference before the new one gains it. You may swapScenes on aWindowat any time, even if it is an instance ofStageand withfullScreenset to true. If the width or height of thisWindowhave never been set by the application, setting the scene will cause thisWindowto take its width or height from that scene. Resizing this window by end user does not count as setting the width or height by the application. AnIllegalStateExceptionis thrown if this property is set on a thread other than the JavaFX Application Thread.- Default value:
- null
- See Also:
- getScene(),- setScene(Scene)
 
- 
setOpacitypublic final void setOpacity(double value)Sets the value of the property opacity.- Property description:
- Defines the opacity of the Windowas a value between 0.0 and 1.0. The opacity is reflected across theWindow, itsDecorationand itsScenecontent. On a JavaFX runtime platform that does not support opacity, assigning a value to this variable will have no visible difference. AWindowwith 0% opacity is fully translucent. Typically, aWindowwith 0% opacity will not receive any mouse events.
- Default value:
- 1.0
 
- 
getOpacitypublic final double getOpacity()Gets the value of the property opacity.- Property description:
- Defines the opacity of the Windowas a value between 0.0 and 1.0. The opacity is reflected across theWindow, itsDecorationand itsScenecontent. On a JavaFX runtime platform that does not support opacity, assigning a value to this variable will have no visible difference. AWindowwith 0% opacity is fully translucent. Typically, aWindowwith 0% opacity will not receive any mouse events.
- Default value:
- 1.0
 
- 
opacityPropertyDefines the opacity of theWindowas a value between 0.0 and 1.0. The opacity is reflected across theWindow, itsDecorationand itsScenecontent. On a JavaFX runtime platform that does not support opacity, assigning a value to this variable will have no visible difference. AWindowwith 0% opacity is fully translucent. Typically, aWindowwith 0% opacity will not receive any mouse events.- Default value:
- 1.0
- See Also:
- getOpacity(),- setOpacity(double)
 
- 
setOnCloseRequestSets the value of the property onCloseRequest.- Property description:
- Called when there is an external request to close this Window. The installed event handler can prevent window closing by consuming the received event.
 
- 
getOnCloseRequestGets the value of the property onCloseRequest.- Property description:
- Called when there is an external request to close this Window. The installed event handler can prevent window closing by consuming the received event.
 
- 
onCloseRequestPropertyCalled when there is an external request to close thisWindow. The installed event handler can prevent window closing by consuming the received event.
- 
setOnShowingSets the value of the property onShowing.- Property description:
- Called just prior to the Window being shown.
 
- 
getOnShowingGets the value of the property onShowing.- Property description:
- Called just prior to the Window being shown.
 
- 
onShowingPropertyCalled just prior to the Window being shown.- See Also:
- getOnShowing(),- setOnShowing(EventHandler)
 
- 
setOnShownSets the value of the property onShown.- Property description:
- Called just after the Window is shown.
 
- 
getOnShownGets the value of the property onShown.- Property description:
- Called just after the Window is shown.
 
- 
onShownPropertyCalled just after the Window is shown.- See Also:
- getOnShown(),- setOnShown(EventHandler)
 
- 
setOnHidingSets the value of the property onHiding.- Property description:
- Called just prior to the Window being hidden.
 
- 
getOnHidingGets the value of the property onHiding.- Property description:
- Called just prior to the Window being hidden.
 
- 
onHidingPropertyCalled just prior to the Window being hidden.- See Also:
- getOnHiding(),- setOnHiding(EventHandler)
 
- 
setOnHiddenSets the value of the property onHidden.- Property description:
- Called just after the Window has been hidden.
 When the Windowis hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when theWindowis closed.
 
- 
getOnHiddenGets the value of the property onHidden.- Property description:
- Called just after the Window has been hidden.
 When the Windowis hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when theWindowis closed.
 
- 
onHiddenPropertyCalled just after the Window has been hidden. When theWindowis hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when theWindowis closed.- See Also:
- getOnHidden(),- setOnHidden(EventHandler)
 
- 
isShowingpublic final boolean isShowing()Gets the value of the property showing.- Property description:
- Whether or not this Windowis showing (that is, open on the user's system). The Window might be "showing", yet the user might not be able to see it due to the Window being rendered behind another Window or due to the Window being positioned off the monitor.
- Default value:
- false
 
- 
showingPropertyWhether or not thisWindowis showing (that is, open on the user's system). The Window might be "showing", yet the user might not be able to see it due to the Window being rendered behind another Window or due to the Window being positioned off the monitor.- Default value:
- false
- See Also:
- isShowing()
 
- 
showprotected void show()Attempts to show this Window by setting visibility to true- Throws:
- IllegalStateException- if this method is called on a thread other than the JavaFX Application Thread.
 
- 
hidepublic void hide()Attempts to hide this Window by setting the visibility to false.- Throws:
- IllegalStateException- if this method is called on a thread other than the JavaFX Application Thread.
 
- 
setEventDispatcherSets the value of the property eventDispatcher.- Property description:
- Specifies the event dispatcher for this node. The default event
 dispatcher sends the received events to the registered event handlers and
 filters. When replacing the value with a new EventDispatcher, the new dispatcher should forward events to the replaced dispatcher to maintain the node's default event handling behavior.
 
- 
getEventDispatcherGets the value of the property eventDispatcher.- Property description:
- Specifies the event dispatcher for this node. The default event
 dispatcher sends the received events to the registered event handlers and
 filters. When replacing the value with a new EventDispatcher, the new dispatcher should forward events to the replaced dispatcher to maintain the node's default event handling behavior.
 
- 
eventDispatcherPropertySpecifies the event dispatcher for this node. The default event dispatcher sends the received events to the registered event handlers and filters. When replacing the value with a newEventDispatcher, the new dispatcher should forward events to the replaced dispatcher to maintain the node's default event handling behavior.
- 
addEventHandlerpublic final <T extends Event> void addEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Registers an event handler to this node. The handler is called when the node receives anEventof the specified type during the bubbling phase of event delivery.- Type Parameters:
- T- the specific event class of the handler
- Parameters:
- eventType- the type of the events to receive by the handler
- eventHandler- the handler to register
- Throws:
- NullPointerException- if the event type or handler is null
 
- 
removeEventHandlerpublic final <T extends Event> void removeEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Unregisters a previously registered event handler from this node. One handler might have been registered for different event types, so the caller needs to specify the particular event type from which to unregister the handler.- Type Parameters:
- T- the specific event class of the handler
- Parameters:
- eventType- the event type from which to unregister
- eventHandler- the handler to unregister
- Throws:
- NullPointerException- if the event type or handler is null
 
- 
addEventFilterpublic final <T extends Event> void addEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)Registers an event filter to this node. The filter is called when the node receives anEventof the specified type during the capturing phase of event delivery.- Type Parameters:
- T- the specific event class of the filter
- Parameters:
- eventType- the type of the events to receive by the filter
- eventFilter- the filter to register
- Throws:
- NullPointerException- if the event type or filter is null
 
- 
removeEventFilterpublic final <T extends Event> void removeEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)Unregisters a previously registered event filter from this node. One filter might have been registered for different event types, so the caller needs to specify the particular event type from which to unregister the filter.- Type Parameters:
- T- the specific event class of the filter
- Parameters:
- eventType- the event type from which to unregister
- eventFilter- the filter to unregister
- Throws:
- NullPointerException- if the event type or filter is null
 
- 
setEventHandlerprotected final <T extends Event> void setEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)Sets the handler to use for this event type. There can only be one such handler specified at a time. This handler is guaranteed to be called first. This is used for registering the user-defined onFoo event handlers.- Type Parameters:
- T- the specific event class of the handler
- Parameters:
- eventType- the event type to associate with the given eventHandler
- eventHandler- the handler to register, or null to unregister
- Throws:
- NullPointerException- if the event type is null
 
- 
fireEventFires the specified event.This method must be called on the FX user thread. - Parameters:
- event- the event to fire
 
- 
buildEventDispatchChainConstruct an event dispatch chain for this window.- Specified by:
- buildEventDispatchChainin interface- EventTarget
- Parameters:
- tail- the initial chain to build from
- Returns:
- the resulting event dispatch chain for this window
 
 
-