Basics
Guides
API Reference
Basics
Guides
API Reference
[27:7] extends: FxObj
The Window class wraps javafx.stage.Window, the base class for every top-level JavaFX window surface (Stage and, through PopupWindow and PopupControl, ContextMenu and Tooltip). It provides the on-screen geometry (x, y, width, height), opacity, focus and showing state, the backing scene, arbitrary user data, the show/hide lifecycle event handlers, and the render scaling settings. This wrapper is not constructed directly. Concrete window types extend it, mirroring the JavaFX inheritance model, and set this.obj in their own constructors. The event handler and filter methods (addEventHandler, addEventFilter, removeEventHandler, removeEventFilter) and fireEvent are wrapped below; they take an EventType obtained with fx.eventType(...), for example fx.eventType(fxevent.WINDOW_SHOWING). The event-dispatcher internals (getEventDispatcher, setEventDispatcher, buildEventDispatchChain) are intentionally not wrapped here; they are advanced routing hooks rarely used from application code.
Window ()
Base constructor. Window is abstract and is never instantiated on its own.
setX (double X)
Sets the window x position on screen, in pixels.
X is a double with the x coordinate.this object for chaininggetX ()
Returns the window x position on screen, in pixels.
A double with the x coordinate.xProperty ()
Returns the ReadOnlyDoubleProperty backing the x position.
An AJO wrapping ReadOnlyDoubleProperty.setY (double Y)
Sets the window y position on screen, in pixels.
Y is a double with the y coordinate.this object for chaininggetY ()
Returns the window y position on screen, in pixels.
A double with the y coordinate.yProperty ()
Returns the ReadOnlyDoubleProperty backing the y position.
An AJO wrapping ReadOnlyDoubleProperty.setWidth (double W)
Sets the window width in pixels.
W is a double with the width.this object for chaininggetWidth ()
Returns the window width in pixels.
A double with the width.widthProperty ()
Returns the ReadOnlyDoubleProperty backing the width.
An AJO wrapping ReadOnlyDoubleProperty.setHeight (double H)
Sets the window height in pixels.
H is a double with the height.this object for chaininggetHeight ()
Returns the window height in pixels.
A double with the height.heightProperty ()
Returns the ReadOnlyDoubleProperty backing the height.
An AJO wrapping ReadOnlyDoubleProperty.setOpacity (double Opacity)
Sets the window opacity from 0.0 (transparent) to 1.0 (opaque).
Opacity is a double in the range 0.0 to 1.0.this object for chaininggetOpacity ()
Returns the window opacity.
A double in the range 0.0 to 1.0.opacityProperty ()
Returns the DoubleProperty backing the opacity.
An AJO wrapping javafx.beans.property.DoubleProperty.isShowing ()
Returns whether the window is currently showing.
A bool that is true while the window is visible.showingProperty ()
Returns the ReadOnlyBooleanProperty backing the showing state.
An AJO wrapping ReadOnlyBooleanProperty.isFocused ()
Returns whether the window currently has input focus.
A bool that is true when the window is focused.focusedProperty ()
Returns the ReadOnlyBooleanProperty backing the focused state.
An AJO wrapping ReadOnlyBooleanProperty.requestFocus ()
Requests input focus for this window.
this object for chaininggetScene ()
Returns the scene attached to this window.
An AJO wrapping javafx.scene.Scene, or null when none is set.sceneProperty ()
Returns the ReadOnlyObjectProperty backing the scene.
An AJO wrapping ReadOnlyObjectPropertysetUserData (Value)
Sets an arbitrary user data object on this window.
Value is the user data to store, either a primitive, a raw AJO, or null.this object for chaininggetUserData ()
Returns the user data object set on this window.
The stored user data, or null.getProperties ()
Returns the general-purpose observable property map for this window, used to attach arbitrary key/value data. The map is created on first access.
An AJO wrapping ObservableMap<Object, Object>.hasProperties ()
Returns whether this window has a non-empty property map. This avoids creating the map through getProperties() just to test it.
A bool that is true when the property map exists and is non-empty.centerOnScreen ()
Centers the window on the primary screen.
this object for chainingsizeToScene ()
Resizes the window to fit the size of its scene content.
this object for chaininghide ()
Hides the window.
this object for chainingsetOnShowing (callback Cb)
Registers a callback invoked just before the window is shown.
Cb is a callback invoked with a WindowEvent.this object for chaininggetOnShowing ()
Returns the onShowing handler.
An AJO wrapping javafx.event.EventHandler, or null.onShowingProperty ()
Returns the ObjectProperty backing the onShowing handler.
An AJO wrapping ObjectPropertysetOnShown (callback Cb)
Registers a callback invoked just after the window is shown.
Cb is a callback invoked with a WindowEvent.this object for chaininggetOnShown ()
Returns the onShown handler.
An AJO wrapping javafx.event.EventHandler, or null.onShownProperty ()
Returns the ObjectProperty backing the onShown handler.
An AJO wrapping ObjectPropertysetOnHiding (callback Cb)
Registers a callback invoked just before the window is hidden.
Cb is a callback invoked with a WindowEvent.this object for chaininggetOnHiding ()
Returns the onHiding handler.
An AJO wrapping javafx.event.EventHandler, or null.onHidingProperty ()
Returns the ObjectProperty backing the onHiding handler.
An AJO wrapping ObjectPropertysetOnHidden (callback Cb)
Registers a callback invoked just after the window is hidden.
Cb is a callback invoked with a WindowEvent.this object for chaininggetOnHidden ()
Returns the onHidden handler.
An AJO wrapping javafx.event.EventHandler, or null.onHiddenProperty ()
Returns the ObjectProperty backing the onHidden handler.
An AJO wrapping ObjectPropertysetOnCloseRequest (callback Cb)
Registers a callback invoked when the window receives a close request.
Cb is a callback invoked with a WindowEvent.this object for chaininggetOnCloseRequest ()
Returns the onCloseRequest handler.
An AJO wrapping javafx.event.EventHandler, or null.onCloseRequestProperty ()
Returns the ObjectProperty backing the onCloseRequest handler.
An AJO wrapping ObjectPropertysetRenderScaleX (double Scale)
Sets the horizontal render scale for the window.
Scale is a double with the render scale.this object for chaininggetRenderScaleX ()
Returns the horizontal render scale for the window.
A double with the render scale.renderScaleXProperty ()
Returns the DoubleProperty backing the horizontal render scale.
An AJO wrapping javafx.beans.property.DoubleProperty.setRenderScaleY (double Scale)
Sets the vertical render scale for the window.
Scale is a double with the render scale.this object for chaininggetRenderScaleY ()
Returns the vertical render scale for the window.
A double with the render scale.renderScaleYProperty ()
Returns the DoubleProperty backing the vertical render scale.
An AJO wrapping javafx.beans.property.DoubleProperty.getOutputScaleX ()
Returns the horizontal output scale (the backing screen scale) for the window.
A double with the output scale.outputScaleXProperty ()
Returns the ReadOnlyDoubleProperty backing the horizontal output scale.
An AJO wrapping ReadOnlyDoubleProperty.getOutputScaleY ()
Returns the vertical output scale (the backing screen scale) for the window.
A double with the output scale.outputScaleYProperty ()
Returns the ReadOnlyDoubleProperty backing the vertical output scale.
An AJO wrapping ReadOnlyDoubleProperty.setForceIntegerRenderScale (bool Force)
Sets whether the render scale is forced to an integer value.
Force is a bool; true forces an integer render scale.this object for chainingisForceIntegerRenderScale ()
Returns whether the render scale is forced to an integer value.
A bool that is true when an integer render scale is forced.forceIntegerRenderScaleProperty ()
Returns the BooleanProperty backing the force-integer-render-scale flag.
An AJO wrapping javafx.beans.property.BooleanProperty.getWindows ()
Returns the observable list of all currently open windows. This wraps the static JavaFX method Window.getWindows().
An AJO wrapping ObservableListaddEventHandler (object EventTypeObj, callback Cb)
Adds an event handler for the given event type. The handler fires in the bubbling phase, and multiple handlers may be registered for one type.
EventTypeObj is an event type, obtained from fx.eventType(...), for example fx.eventType(fxevent.WINDOW_SHOWING).Cb is a callback that receives the event.A handler reference. Keep it if you intend to remove the handler later with removeEventHandler; otherwise it can be ignored.removeEventHandler (object EventTypeObj, object Handler)
Removes a handler previously added with addEventHandler. JavaFX matches by identity, so pass the handler reference that addEventHandler returned.
EventTypeObj is an event type, obtained from fx.eventType(...).Handler is the handler reference returned by addEventHandler.this object for chainingaddEventFilter (object EventTypeObj, callback Cb)
Adds an event filter for the given event type. Filters fire in the capturing phase, before handlers, so a filter can inspect or consume an event before it reaches its target. This is the only way to intercept an event during capture; there is no convenience setter for filters.
EventTypeObj is an event type, obtained from fx.eventType(...).Cb is a callback that receives the event.A filter reference. Keep it if you intend to remove the filter later with removeEventFilter; otherwise it can be ignored.removeEventFilter (object EventTypeObj, object Handler)
Removes a filter previously added with addEventFilter. Pass the filter reference that addEventFilter returned.
EventTypeObj is an event type, obtained from fx.eventType(...).Handler is the filter reference returned by addEventFilter.this object for chainingfireEvent (object EventObj)
Fires the given event on this window, dispatching it through the normal capture-and-bubble chain.
EventObj is a javafx.event.Event to dispatch.this object for chaining
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.