public class Window
extends java.lang.Object
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 javafx.application.Application
class and
the Platform#startup(Runnable)
method for more information.
Type | Property and Description |
---|---|
<any> |
eventDispatcher
Specifies the event dispatcher for this node.
|
ReadOnlyBooleanProperty |
focused
Whether or not this
Window has the keyboard or input focus. |
BooleanProperty |
forceIntegerRenderScale
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.
|
ReadOnlyDoubleProperty |
height
The height of this
Window . |
<any> |
onCloseRequest
Called when there is an external request to close this
Window . |
<any> |
onHidden
Called just after the Window has been hidden.
|
<any> |
onHiding
Called just prior to the Window being hidden.
|
<any> |
onShowing
Called just prior to the Window being shown.
|
<any> |
onShown
Called just after the Window is shown.
|
DoubleProperty |
opacity
Defines the opacity of the
Window as a value between 0.0 and 1.0. |
ReadOnlyDoubleProperty |
outputScaleX
The scale that the
Window will apply to horizontal scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
ReadOnlyDoubleProperty |
outputScaleY
The scale that the
Window will apply to vertical scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
DoubleProperty |
renderScaleX
The horizontal scale that the
Window will use when rendering
its Scene to the rendering buffer. |
DoubleProperty |
renderScaleY
The vertical scale that the
Window will use when rendering
its Scene to the rendering buffer. |
<any> |
scene
The
Scene to be rendered on this Window . |
ReadOnlyBooleanProperty |
showing
Whether or not this
Window is showing (that is, open on the
user's system). |
ReadOnlyDoubleProperty |
width
The width of this
Window . |
ReadOnlyDoubleProperty |
x
The horizontal location of this
Window on the screen. |
ReadOnlyDoubleProperty |
y
The vertical location of this
Window on the screen. |
Modifier and Type | Class and Description |
---|---|
private class |
Window.SceneModel |
private class |
Window.TKBoundsConfigurator
Caches all requested bounds settings and applies them at once during
the next pulse.
|
Modifier and Type | Field and Description |
---|---|
(package private) java.security.AccessControlContext |
acc |
private static float |
CENTER_ON_SCREEN_X_FRACTION |
private static float |
CENTER_ON_SCREEN_Y_FRACTION |
private <any> |
eventDispatcher
Specifies the event dispatcher for this node.
|
private ReadOnlyBooleanWrapper |
focused
Whether or not this
Window has the keyboard or input focus. |
private int |
focusGrabCounter |
private BooleanProperty |
forceIntegerRenderScale
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.
|
(package private) boolean |
hasBeenVisible |
private ReadOnlyDoubleWrapper |
height
The height of this
Window . |
private boolean |
heightExplicit |
private WindowEventDispatcher |
internalEventDispatcher |
private <any> |
onCloseRequest
Called when there is an external request to close this
Window . |
private <any> |
onHidden
Called just after the Window has been hidden.
|
private <any> |
onHiding
Called just prior to the Window being hidden.
|
private <any> |
onShowing
Called just prior to the Window being shown.
|
private <any> |
onShown
Called just after the Window is shown.
|
private DoubleProperty |
opacity
Defines the opacity of the
Window as a value between 0.0 and 1.0. |
private ReadOnlyDoubleWrapper |
outputScaleX
The scale that the
Window will apply to horizontal scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
private ReadOnlyDoubleWrapper |
outputScaleY
The scale that the
Window will apply to vertical scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
private TKStage |
peer |
private Window.TKBoundsConfigurator |
peerBoundsConfigurator |
private WindowPeerListener |
peerListener |
private <any> |
properties |
private DoubleProperty |
renderScaleX
The horizontal scale that the
Window will use when rendering
its Scene to the rendering buffer. |
private DoubleProperty |
renderScaleY
The vertical scale that the
Window will use when rendering
its Scene to the rendering buffer. |
private Window.SceneModel |
scene
The
Scene to be rendered on this Window . |
private <any> |
screen |
private ReadOnlyBooleanWrapper |
showing
Whether or not this
Window is showing (that is, open on the
user's system). |
private boolean |
sizeToScene
Indicates if a user requested the window to be sized to match the scene
size.
|
private static <any> |
unmodifiableWindows |
private static java.lang.Object |
USER_DATA_KEY
*
*
*
|
private ReadOnlyDoubleWrapper |
width
The width of this
Window . |
private boolean |
widthExplicit |
private WindowHelper |
windowHelper |
private static <any> |
windows
A list of all the currently _showing_ windows.
|
private ReadOnlyDoubleWrapper |
x
The horizontal location of this
Window on the screen. |
private boolean |
xExplicit |
private ReadOnlyDoubleWrapper |
y
The vertical location of this
Window on the screen. |
private boolean |
yExplicit |
Modifier | Constructor and Description |
---|---|
protected |
Window() |
Modifier and Type | Method and Description |
---|---|
<T extends Event> |
addEventFilter(<any> eventType,
<any> eventFilter)
Registers an event filter to this node.
|
<T extends Event> |
addEventHandler(<any> eventType,
<any> eventHandler)
Registers an event handler to this node.
|
private void |
adjustSize(boolean selfSizePriority) |
(package private) void |
applyBounds() |
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.
|
(package private) WindowEventDispatcher |
createInternalEventDispatcher() |
(package private) void |
decreaseFocusGrabCounter() |
private void |
doVisibleChanged(boolean visible) |
private void |
doVisibleChanging(boolean visible) |
<any> |
eventDispatcherProperty()
Specifies the event dispatcher for this node.
|
void |
fireEvent(Event event)
Fires the specified event.
|
private void |
focusChanged(boolean newIsFocused) |
ReadOnlyBooleanProperty |
focusedProperty()
Whether or not this
Window has the keyboard or input focus. |
BooleanProperty |
forceIntegerRenderScaleProperty()
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.
|
EventDispatcher |
getEventDispatcher()
Gets the value of the property eventDispatcher.
|
double |
getHeight()
Gets the value of the property height.
|
(package private) WindowEventDispatcher |
getInternalEventDispatcher() |
<any> |
getOnCloseRequest()
Gets the value of the property onCloseRequest.
|
<any> |
getOnHidden()
Gets the value of the property onHidden.
|
<any> |
getOnHiding()
Gets the value of the property onHiding.
|
<any> |
getOnShowing()
Gets the value of the property onShowing.
|
<any> |
getOnShown()
Gets the value of the property onShown.
|
double |
getOpacity()
Gets the value of the property opacity.
|
double |
getOutputScaleX()
Gets the value of the property outputScaleX.
|
double |
getOutputScaleY()
Gets the value of the property outputScaleY.
|
(package private) TKStage |
getPeer() |
(package private) WindowPeerListener |
getPeerListener() |
<any> |
getProperties()
Returns an observable map of properties on this node for use primarily
by application developers.
|
double |
getRenderScaleX()
Gets the value of the property renderScaleX.
|
double |
getRenderScaleY()
Gets the value of the property renderScaleY.
|
Scene |
getScene()
Gets the value of the property scene.
|
java.lang.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()
Gets the value of the property width.
|
(package private) Window |
getWindowOwner() |
static <any> |
getWindows()
Returns a list containing a reference to the currently showing JavaFX windows.
|
private Screen |
getWindowScreen() |
double |
getX()
Gets the value of the property x.
|
double |
getY()
Gets the value of the property y.
|
boolean |
hasProperties()
Tests if Window has properties.
|
ReadOnlyDoubleProperty |
heightProperty()
The height of this
Window . |
void |
hide()
Attempts to hide this Window by setting the visibility to false.
|
(package private) void |
increaseFocusGrabCounter() |
private void |
initializeInternalEventDispatcher() |
boolean |
isFocused()
Gets the value of the property focused.
|
boolean |
isForceIntegerRenderScale()
Gets the value of the property forceIntegerRenderScale.
|
boolean |
isShowing()
Gets the value of the property showing.
|
(package private) void |
notifyLocationChanged(double newX,
double newY)
Notification from the windowing system that the window's position has
changed.
|
private void |
notifyScreenChanged(java.lang.Object from,
java.lang.Object to) |
(package private) void |
notifySizeChanged(double newWidth,
double newHeight)
Notification from the windowing system that the window's size has
changed.
|
<any> |
onCloseRequestProperty()
Called when there is an external request to close this
Window . |
<any> |
onHiddenProperty()
Called just after the Window has been hidden.
|
<any> |
onHidingProperty()
Called just prior to the Window being hidden.
|
<any> |
onShowingProperty()
Called just prior to the Window being shown.
|
<any> |
onShownProperty()
Called just after the Window is shown.
|
DoubleProperty |
opacityProperty()
Defines the opacity of the
Window as a value between 0.0 and 1.0. |
ReadOnlyDoubleProperty |
outputScaleXProperty()
The scale that the
Window will apply to horizontal scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
ReadOnlyDoubleProperty |
outputScaleYProperty()
The scale that the
Window will apply to vertical scene
coordinates in all stages of rendering and compositing the output
to the screen or other destination device. |
<T extends Event> |
removeEventFilter(<any> eventType,
<any> eventFilter)
Unregisters a previously registered event filter from this node.
|
<T extends Event> |
removeEventHandler(<any> eventType,
<any> eventHandler)
Unregisters a previously registered event handler from this node.
|
DoubleProperty |
renderScaleXProperty()
The horizontal scale that the
Window will use when rendering
its Scene to the rendering buffer. |
DoubleProperty |
renderScaleYProperty()
The vertical scale that the
Window will use when rendering
its Scene to the rendering buffer. |
void |
requestFocus()
Requests that this
Window get the input focus. |
<any> |
sceneProperty()
The
Scene to be rendered on this Window . |
private <any> |
screenProperty() |
void |
setEventDispatcher(EventDispatcher value)
Sets the value of the property eventDispatcher.
|
protected <T extends Event> |
setEventHandler(<any> eventType,
<any> eventHandler)
Sets the handler to use for this event type.
|
(package private) void |
setFocused(boolean value) |
void |
setForceIntegerRenderScale(boolean forced)
Sets the value of the property forceIntegerRenderScale.
|
void |
setHeight(double value)
Sets the value of the property height.
|
void |
setOnCloseRequest(<any> value)
Sets the value of the property onCloseRequest.
|
void |
setOnHidden(<any> value)
Sets the value of the property onHidden.
|
void |
setOnHiding(<any> value)
Sets the value of the property onHiding.
|
void |
setOnShowing(<any> value)
Sets the value of the property onShowing.
|
void |
setOnShown(<any> value)
Sets the value of the property onShown.
|
void |
setOpacity(double value)
Sets the value of the property opacity.
|
(package private) void |
setPeer(TKStage peer) |
(package private) void |
setPeerListener(WindowPeerListener peerListener) |
void |
setRenderScaleX(double scale)
Sets the value of the property renderScaleX.
|
void |
setRenderScaleY(double scale)
Sets the value of the property renderScaleY.
|
protected void |
setScene(Scene value)
Sets the value of the property scene.
|
private void |
setShowing(boolean value) |
void |
setUserData(java.lang.Object value)
Convenience method for setting a single Object property that can be
retrieved at a later date.
|
void |
setWidth(double value)
Sets the value of the property width.
|
void |
setX(double value)
Sets the value of the property x.
|
(package private) void |
setXInternal(double value) |
void |
setY(double value)
Sets the value of the property y.
|
(package private) void |
setYInternal(double value) |
protected void |
show()
Attempts to show this Window by setting visibility to true
|
ReadOnlyBooleanProperty |
showingProperty()
Whether or not this
Window is showing (that is, open on the
user's system). |
void |
sizeToScene()
Set the width and height of this Window to match the size of the content
of this Window's Scene.
|
private void |
updateOutputScales(double sx,
double sy) |
(package private) void |
updateRenderScales(double sx,
double sy) |
ReadOnlyDoubleProperty |
widthProperty()
The width of this
Window . |
ReadOnlyDoubleProperty |
xProperty()
The horizontal location of this
Window on the screen. |
ReadOnlyDoubleProperty |
yProperty()
The vertical location of this
Window on the screen. |
public final ReadOnlyDoubleProperty outputScaleXProperty
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
getOutputScaleX()
public final ReadOnlyDoubleProperty outputScaleYProperty
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
getOutputScaleY()
public final BooleanProperty forceIntegerRenderScaleProperty
renderScale
properties will be updated directly and
simultaneously with any changes in the associated outputScale
properties, but the values can be overridden by subsequent calls to
the setRenderScale
setters or through appropriate use of
binding.
This property will not prevent setting non-integer scales
directly using the renderScale
property object or the
convenience setter method.isForceIntegerRenderScale()
,
setForceIntegerRenderScale(boolean)
public final DoubleProperty renderScaleXProperty
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleX
property and can be overridden either by
calling setRenderScaleX()
in response to a listener on the
outputScaleX
property or by binding it appropriately.getRenderScaleX()
,
setRenderScaleX(double)
public final DoubleProperty renderScaleYProperty
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleY
property and can be overridden either by
calling setRenderScaleY()
in response to a listener on the
outputScaleY
property or by binding it appropriately.getRenderScaleY()
,
setRenderScaleY(double)
public final ReadOnlyDoubleProperty xProperty
Window
on the screen. Changing
this attribute will move the Window
horizontally. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.getX()
,
setX(double)
public final ReadOnlyDoubleProperty yProperty
Window
on the screen. Changing this
attribute will move the Window
vertically. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.getY()
,
setY(double)
public final ReadOnlyDoubleProperty widthProperty
Window
. Changing this attribute will narrow or
widen the width of the Window
. This value includes any and all
decorations which may be added by the Operating System such as resizable
frame handles. Typical applications will set the javafx.scene.Scene
width instead. This Window
will 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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
getWidth()
,
setWidth(double)
public final ReadOnlyDoubleProperty heightProperty
Window
. Changing this attribute will shrink
or heighten the height of the Window
. This value includes any and all
decorations which may be added by the Operating System such as the title
bar. Typical applications will set the javafx.scene.Scene
height
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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
getHeight()
,
setHeight(double)
public final ReadOnlyBooleanProperty focusedProperty
Window
has 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.
isFocused()
public final <any> sceneProperty
Scene
to be rendered on this Window
. There can only
be one Scene
on the Window
at a time, and a Scene
can only be on one Window
at a time. Setting a Scene
on
a different Window
will cause the old Window
to lose the
reference before the new one gains it. You may swap Scene
s on
a Window
at any time, even if it is an instance of Stage
and with fullScreen
set to true.
If the width or height of this Window
have never been set by the
application, setting the scene will cause this Window
to 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.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.getScene()
,
setScene(Scene)
public final DoubleProperty opacityProperty
Window
as a value between 0.0 and 1.0.
The opacity is reflected across the Window
, its Decoration
and its Scene
content. On a JavaFX runtime platform that does not
support opacity, assigning a value to this variable will have no
visible difference. A Window
with 0% opacity is fully translucent.
Typically, a Window
with 0% opacity will not receive any mouse
events.getOpacity()
,
setOpacity(double)
public final <any> onCloseRequestProperty
Window
.
The installed event handler can prevent window closing by consuming the
received event.getOnCloseRequest()
,
#setOnCloseRequest()
public final <any> onShowingProperty
getOnShowing()
,
#setOnShowing()
public final <any> onShownProperty
getOnShown()
,
#setOnShown()
public final <any> onHidingProperty
getOnHiding()
,
#setOnHiding()
public final <any> onHiddenProperty
Window
is hidden, this event handler is invoked allowing
the developer to clean up resources or perform other tasks when the
Window
is closed.getOnHidden()
,
#setOnHidden()
public final ReadOnlyBooleanProperty showingProperty
Window
is 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.isShowing()
public final <any> eventDispatcherProperty
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.private static <any> windows
private static <any> unmodifiableWindows
private WindowHelper windowHelper
final java.security.AccessControlContext acc
private WindowPeerListener peerListener
private TKStage peer
private Window.TKBoundsConfigurator peerBoundsConfigurator
private boolean sizeToScene
private static final float CENTER_ON_SCREEN_X_FRACTION
private static final float CENTER_ON_SCREEN_Y_FRACTION
private ReadOnlyDoubleWrapper outputScaleX
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
renderScaleXProperty()
private ReadOnlyDoubleWrapper outputScaleY
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
renderScaleYProperty()
private BooleanProperty forceIntegerRenderScale
renderScale
properties will be updated directly and
simultaneously with any changes in the associated outputScale
properties, but the values can be overridden by subsequent calls to
the setRenderScale
setters or through appropriate use of
binding.
This property will not prevent setting non-integer scales
directly using the renderScale
property object or the
convenience setter method.renderScaleXProperty()
,
renderScaleYProperty()
private DoubleProperty renderScaleX
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleX
property and can be overridden either by
calling setRenderScaleX()
in response to a listener on the
outputScaleX
property or by binding it appropriately.outputScaleXProperty()
,
forceIntegerRenderScaleProperty()
private DoubleProperty renderScaleY
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleY
property and can be overridden either by
calling setRenderScaleY()
in response to a listener on the
outputScaleY
property or by binding it appropriately.outputScaleYProperty()
,
forceIntegerRenderScaleProperty()
private boolean xExplicit
private ReadOnlyDoubleWrapper x
Window
on the screen. Changing
this attribute will move the Window
horizontally. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.private boolean yExplicit
private ReadOnlyDoubleWrapper y
Window
on the screen. Changing this
attribute will move the Window
vertically. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.private boolean widthExplicit
private ReadOnlyDoubleWrapper width
Window
. Changing this attribute will narrow or
widen the width of the Window
. This value includes any and all
decorations which may be added by the Operating System such as resizable
frame handles. Typical applications will set the javafx.scene.Scene
width instead. This Window
will 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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
private boolean heightExplicit
private ReadOnlyDoubleWrapper height
Window
. Changing this attribute will shrink
or heighten the height of the Window
. This value includes any and all
decorations which may be added by the Operating System such as the title
bar. Typical applications will set the javafx.scene.Scene
height
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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
private ReadOnlyBooleanWrapper focused
Window
has 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.
private static final java.lang.Object USER_DATA_KEY
private <any> properties
private Window.SceneModel scene
Scene
to be rendered on this Window
. There can only
be one Scene
on the Window
at a time, and a Scene
can only be on one Window
at a time. Setting a Scene
on
a different Window
will cause the old Window
to lose the
reference before the new one gains it. You may swap Scene
s on
a Window
at any time, even if it is an instance of Stage
and with fullScreen
set to true.
If the width or height of this Window
have never been set by the
application, setting the scene will cause this Window
to 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.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.private DoubleProperty opacity
Window
as a value between 0.0 and 1.0.
The opacity is reflected across the Window
, its Decoration
and its Scene
content. On a JavaFX runtime platform that does not
support opacity, assigning a value to this variable will have no
visible difference. A Window
with 0% opacity is fully translucent.
Typically, a Window
with 0% opacity will not receive any mouse
events.private <any> onCloseRequest
Window
.
The installed event handler can prevent window closing by consuming the
received event.private <any> onShowing
private <any> onShown
private <any> onHiding
private <any> onHidden
Window
is hidden, this event handler is invoked allowing
the developer to clean up resources or perform other tasks when the
Window
is closed.private ReadOnlyBooleanWrapper showing
Window
is 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.boolean hasBeenVisible
private <any> eventDispatcher
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.private WindowEventDispatcher internalEventDispatcher
private int focusGrabCounter
private final <any> screen
public static <any> getWindows()
UnsupportedOperationException
being thrown at runtime.WindowPeerListener getPeerListener()
void setPeerListener(WindowPeerListener peerListener)
TKStage getPeer()
void setPeer(TKStage peer)
public void sizeToScene()
private void adjustSize(boolean selfSizePriority)
public void centerOnScreen()
private void updateOutputScales(double sx, double sy)
void updateRenderScales(double sx, double sy)
public final double getOutputScaleX()
public final ReadOnlyDoubleProperty outputScaleXProperty()
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
getOutputScaleX()
public final double getOutputScaleY()
public final ReadOnlyDoubleProperty outputScaleYProperty()
Window
will 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:
Screen
which may be before or after the Screen
property is updated.
getOutputScaleY()
public final void setForceIntegerRenderScale(boolean forced)
public final boolean isForceIntegerRenderScale()
public final BooleanProperty forceIntegerRenderScaleProperty()
renderScale
properties will be updated directly and
simultaneously with any changes in the associated outputScale
properties, but the values can be overridden by subsequent calls to
the setRenderScale
setters or through appropriate use of
binding.
This property will not prevent setting non-integer scales
directly using the renderScale
property object or the
convenience setter method.isForceIntegerRenderScale()
,
setForceIntegerRenderScale(boolean)
public final void setRenderScaleX(double scale)
public final double getRenderScaleX()
public final DoubleProperty renderScaleXProperty()
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleX
property and can be overridden either by
calling setRenderScaleX()
in response to a listener on the
outputScaleX
property or by binding it appropriately.getRenderScaleX()
,
setRenderScaleX(double)
public final void setRenderScaleY(double scale)
public final double getRenderScaleY()
public final DoubleProperty renderScaleYProperty()
Window
will use when rendering
its Scene
to the rendering buffer.
This property is automatically updated whenever there is a change in
the outpitScaleY
property and can be overridden either by
calling setRenderScaleY()
in response to a listener on the
outputScaleY
property or by binding it appropriately.getRenderScaleY()
,
setRenderScaleY(double)
public final void setX(double value)
public final double getX()
public final ReadOnlyDoubleProperty xProperty()
Window
on the screen. Changing
this attribute will move the Window
horizontally. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.getX()
,
setX(double)
void setXInternal(double value)
public final void setY(double value)
public final double getY()
public final ReadOnlyDoubleProperty yProperty()
Window
on the screen. Changing this
attribute will move the Window
vertically. If this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.getY()
,
setY(double)
void setYInternal(double value)
void notifyLocationChanged(double newX, double newY)
newX
- the new window x positionnewY
- the new window y positionpublic final void setWidth(double value)
public final double getWidth()
public final ReadOnlyDoubleProperty widthProperty()
Window
. Changing this attribute will narrow or
widen the width of the Window
. This value includes any and all
decorations which may be added by the Operating System such as resizable
frame handles. Typical applications will set the javafx.scene.Scene
width instead. This Window
will 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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
getWidth()
,
setWidth(double)
public final void setHeight(double value)
public final double getHeight()
public final ReadOnlyDoubleProperty heightProperty()
Window
. Changing this attribute will shrink
or heighten the height of the Window
. This value includes any and all
decorations which may be added by the Operating System such as the title
bar. Typical applications will set the javafx.scene.Scene
height
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 this
Window
is an instance of Stage
, changing this attribute
will not visually affect the Window
while
fullScreen
is true, but will be honored
by the Window
once fullScreen
becomes false.
The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.
getHeight()
,
setHeight(double)
void notifySizeChanged(double newWidth, double newHeight)
newWidth
- the new window widthnewHeight
- the new window heightfinal void setFocused(boolean value)
public final void requestFocus()
Window
get the input focus.public final boolean isFocused()
public final ReadOnlyBooleanProperty focusedProperty()
Window
has 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.
isFocused()
public final <any> getProperties()
public boolean hasProperties()
public void setUserData(java.lang.Object value)
getUserData()
.value
- The value to be stored - this can later be retrieved by calling
getUserData()
.public java.lang.Object getUserData()
setUserData(java.lang.Object)
method.protected void setScene(Scene value)
public final Scene getScene()
public final <any> sceneProperty()
Scene
to be rendered on this Window
. There can only
be one Scene
on the Window
at a time, and a Scene
can only be on one Window
at a time. Setting a Scene
on
a different Window
will cause the old Window
to lose the
reference before the new one gains it. You may swap Scene
s on
a Window
at any time, even if it is an instance of Stage
and with fullScreen
set to true.
If the width or height of this Window
have never been set by the
application, setting the scene will cause this Window
to 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.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.getScene()
,
setScene(Scene)
public final void setOpacity(double value)
public final double getOpacity()
public final DoubleProperty opacityProperty()
Window
as a value between 0.0 and 1.0.
The opacity is reflected across the Window
, its Decoration
and its Scene
content. On a JavaFX runtime platform that does not
support opacity, assigning a value to this variable will have no
visible difference. A Window
with 0% opacity is fully translucent.
Typically, a Window
with 0% opacity will not receive any mouse
events.getOpacity()
,
setOpacity(double)
public final void setOnCloseRequest(<any> value)
public final <any> getOnCloseRequest()
public final <any> onCloseRequestProperty()
Window
.
The installed event handler can prevent window closing by consuming the
received event.getOnCloseRequest()
,
#setOnCloseRequest()
public final void setOnShowing(<any> value)
public final <any> getOnShowing()
public final <any> onShowingProperty()
getOnShowing()
,
#setOnShowing()
public final void setOnShown(<any> value)
public final <any> getOnShown()
public final <any> onShownProperty()
getOnShown()
,
#setOnShown()
public final void setOnHiding(<any> value)
public final <any> getOnHiding()
public final <any> onHidingProperty()
getOnHiding()
,
#setOnHiding()
public final void setOnHidden(<any> value)
public final <any> getOnHidden()
public final <any> onHiddenProperty()
Window
is hidden, this event handler is invoked allowing
the developer to clean up resources or perform other tasks when the
Window
is closed.getOnHidden()
,
#setOnHidden()
private void setShowing(boolean value)
public final boolean isShowing()
public final ReadOnlyBooleanProperty showingProperty()
Window
is 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.isShowing()
protected void show()
java.lang.IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.public void hide()
java.lang.IllegalStateException
- if this method is called on a thread
other than the JavaFX Application Thread.private void doVisibleChanging(boolean visible)
private void doVisibleChanged(boolean visible)
public final void setEventDispatcher(EventDispatcher value)
public final EventDispatcher getEventDispatcher()
public final <any> eventDispatcherProperty()
EventDispatcher
,
the new dispatcher should forward events to the replaced dispatcher
to maintain the node's default event handling behavior.public final <T extends Event> void addEventHandler(<any> eventType, <any> 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 registerjava.lang.NullPointerException
- if the event type or handler is nullpublic final <T extends Event> void removeEventHandler(<any> eventType, <any> eventHandler)
T
- the specific event class of the handlereventType
- the event type from which to unregistereventHandler
- the handler to unregisterjava.lang.NullPointerException
- if the event type or handler is nullpublic final <T extends Event> void addEventFilter(<any> eventType, <any> 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 registerjava.lang.NullPointerException
- if the event type or filter is nullpublic final <T extends Event> void removeEventFilter(<any> eventType, <any> eventFilter)
T
- the specific event class of the filtereventType
- the event type from which to unregistereventFilter
- the filter to unregisterjava.lang.NullPointerException
- if the event type or filter is nullprotected final <T extends Event> void setEventHandler(<any> eventType, <any> 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 unregisterjava.lang.NullPointerException
- if the event type is nullWindowEventDispatcher getInternalEventDispatcher()
private void initializeInternalEventDispatcher()
WindowEventDispatcher createInternalEventDispatcher()
public final void fireEvent(Event event)
This method must be called on the FX user thread.
event
- the event to firepublic EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
tail
- the initial chain to build fromvoid increaseFocusGrabCounter()
void decreaseFocusGrabCounter()
private void focusChanged(boolean newIsFocused)
final void applyBounds()
Window getWindowOwner()
private Screen getWindowScreen()
private <any> screenProperty()
private void notifyScreenChanged(java.lang.Object from, java.lang.Object to)