Spec-Zone .ru
спецификации, руководства, описания, API
|
public class Stage extends Window
Stage
class is the top level JavaFX container.
The primary Stage is constructed by the platform. Additional Stage
objects may be constructed by the application.
Stage objects must be constructed and modified on the JavaFX Application Thread.
Example:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class HelloWorld extends Application {
@Override public void start(Stage stage) {
Scene scene = new Scene(new Group(new Text(25, 25, "Hello World!")));
stage.setTitle("Welcome to JavaFX!");
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
produces the following on Mac OSX:
produces the following on Windows XP:
produces the following on Windows Vista:
Type | Property and Description |
---|---|
ReadOnlyBooleanProperty |
fullScreen
Specifies whether this
Stage should be a full-screen,
undecorated window. |
ReadOnlyBooleanProperty |
iconified
Defines whether the
Stage is iconified or not. |
BooleanProperty |
resizable
Defines whether the
Stage is resizable or not by the user. |
StringProperty |
title
Defines the title of the
Stage . |
eventDispatcherProperty, focusedProperty, heightProperty, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, sceneProperty, showingProperty, widthProperty, xProperty, yProperty
Constructor and Description |
---|
Stage()
Creates a new instance of decorated
Stage . |
Stage(StageStyle style)
Creates a new instance of
Stage . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this
Stage . |
ReadOnlyBooleanProperty |
fullScreenProperty()
Specifies whether this
Stage should be a full-screen,
undecorated window. |
ObservableList<Image> |
getIcons()
Gets the icon images to be used in the window decorations and when
minimized.
|
Modality |
getModality()
Retrieves the modality attribute for this stage.
|
Window |
getOwner()
Retrieves the owner Window for this stage, or null for an unowned stage.
|
StageStyle |
getStyle()
Retrieves the style attribute for this stage.
|
java.lang.String |
getTitle()
Defines the title of the
Stage . |
ReadOnlyBooleanProperty |
iconifiedProperty()
Defines whether the
Stage is iconified or not. |
void |
initModality(Modality modality)
Specifies the modality for this stage.
|
void |
initOwner(Window owner)
Specifies the owner Window for this stage, or null for a top-level,
unowned stage.
|
void |
initStyle(StageStyle style)
Specifies the style for this stage.
|
boolean |
isFullScreen()
Specifies whether this
Stage should be a full-screen,
undecorated window. |
boolean |
isIconified()
Defines whether the
Stage is iconified or not. |
boolean |
isResizable()
Defines whether the
Stage is resizable or not by the user. |
BooleanProperty |
resizableProperty()
Defines whether the
Stage is resizable or not by the user. |
void |
setFullScreen(boolean value)
Specifies whether this
Stage should be a full-screen,
undecorated window. |
void |
setIconified(boolean value)
Defines whether the
Stage is iconified or not. |
void |
setResizable(boolean value)
Defines whether the
Stage is resizable or not by the user. |
void |
setScene(Scene value)
Specify the scene to be used on this stage.
|
void |
setTitle(java.lang.String value)
Defines the title of the
Stage . |
void |
show()
Attempts to show this Window by setting visibility to true
|
StringProperty |
titleProperty()
Defines the title of the
Stage . |
void |
toBack()
Send the
Window to the background. |
void |
toFront()
Bring the
Window to the foreground. |
addEventFilter, addEventHandler, buildEventDispatchChain, centerOnScreen, eventDispatcherProperty, fireEvent, focusedProperty, getEventDispatcher, getHeight, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getOpacity, getScene, getWidth, getX, getY, heightProperty, hide, isFocused, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, opacityProperty, removeEventFilter, removeEventHandler, requestFocus, sceneProperty, setEventDispatcher, setEventHandler, setHeight, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setOpacity, setWidth, setX, setY, showingProperty, sizeToScene, widthProperty, xProperty, yProperty
Stage
should be a full-screen,
undecorated window.
The implementation of full-screen mode is platform and profile-dependent.
When set to true
, the Stage
will attempt to enter
full-screen mode when visible. Set to false
to return Stage
to windowed mode.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.
The full-screen mode will be exited (and the fullScreen
attribute
will be set to false
) if the full-screen
Stage
loses focus or if another Stage
enters
full-screen mode on the same Screen
. Note that a Stage
in full-screen mode can become invisible without losing its
full-screen status and will again enter full-screen mode when the
Stage
becomes visible.
Screen
the Stage will enter full-screen mode on by
setting its position to be within the bounds of that Screen
prior to entering full-screen mode.
However once in full-screen mode, Stage
's x
, y
,
width
, and height
variables will continue to represent
the non-full-screen position and size of the window; the same for
iconified
, resizable
, style
, and opacity
. If changes are made to any of these attributes while in
full-screen mode, upon exiting full-screen mode the Stage
will
assume those attributes.
For desktop profile the runtime will attempt to enter full-screen exclusive mode (FSEM) if such is supported by the platform and it is allowed for this application. If either is not the case a simulated full-screen window will be used instead; the window will be maximized, made undecorated if possible, and moved to the front.
The user can unconditionally exit full-screen mode at any time by pressingESC
.
There are differences in behavior between signed and unsigned applications. Signed applications are allowed to enter full-screen exclusive mode unrestricted while unsigned applications will have the following restrictions:
Node.mousePressed/mouseReleased/mouseClicked
) or keyboard
(Node.keyPressed/keyReleased/keyTyped
) event handlers. It is
not allowed to enter FSEM in response to ESC
key. Attempting to enter FSEM from any other context will result in
emulated full-screen mode.
If Stage
was constructed as full-screen but not visible
it will enter full-screen mode upon becoming visible, with the same
limitations to when this is allowed to happen as when setting
fullScreen
to true
.
UP, DOWN, LEFT, RIGHT, SPACE, TAB, PAGE_UP, PAGE_DOWN, HOME, END, ENTER
isFullScreen()
,
setFullScreen(boolean)
Stage
.getTitle()
,
setTitle(String)
Stage
is iconified or not.isIconified()
,
setIconified(boolean)
Stage
is resizable or not by the user.
Programatically you may still change the size of the Stage. This is
a hint which allows the implementation to optionally make the Stage
resizable by the user.isResizable()
,
setResizable(boolean)
public Stage()
Stage
.java.lang.IllegalStateException
- if this constructor is called on a thread
other than the JavaFX Application Thread.public Stage(StageStyle style)
Stage
.style
- The style of the Stage
java.lang.IllegalStateException
- if this constructor is called on a thread
other than the JavaFX Application Thread.public final void setScene(Scene value)
public final void show()
Window
public final void initStyle(StageStyle style)
style
- the style for this stage.java.lang.IllegalStateException
- if this property is set after the stage
has ever been made visible.public final StageStyle getStyle()
public final void initModality(Modality modality)
modality
- the modality for this stage.java.lang.IllegalStateException
- if this property is set after the stage
has ever been made visible.java.lang.IllegalStateException
- if this stage is the primary stage.public final Modality getModality()
public final void initOwner(Window owner)
owner
- the owner for this stage.java.lang.IllegalStateException
- if this property is set after the stage
has ever been made visible.java.lang.IllegalStateException
- if this stage is the primary stage.public final Window getOwner()
public final void setFullScreen(boolean value)
Stage
should be a full-screen,
undecorated window.
The implementation of full-screen mode is platform and profile-dependent.
When set to true
, the Stage
will attempt to enter
full-screen mode when visible. Set to false
to return Stage
to windowed mode.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.
The full-screen mode will be exited (and the fullScreen
attribute
will be set to false
) if the full-screen
Stage
loses focus or if another Stage
enters
full-screen mode on the same Screen
. Note that a Stage
in full-screen mode can become invisible without losing its
full-screen status and will again enter full-screen mode when the
Stage
becomes visible.
Screen
the Stage will enter full-screen mode on by
setting its position to be within the bounds of that Screen
prior to entering full-screen mode.
However once in full-screen mode, Stage
's x
, y
,
width
, and height
variables will continue to represent
the non-full-screen position and size of the window; the same for
iconified
, resizable
, style
, and opacity
. If changes are made to any of these attributes while in
full-screen mode, upon exiting full-screen mode the Stage
will
assume those attributes.
For desktop profile the runtime will attempt to enter full-screen exclusive mode (FSEM) if such is supported by the platform and it is allowed for this application. If either is not the case a simulated full-screen window will be used instead; the window will be maximized, made undecorated if possible, and moved to the front.
The user can unconditionally exit full-screen mode at any time by pressingESC
.
There are differences in behavior between signed and unsigned applications. Signed applications are allowed to enter full-screen exclusive mode unrestricted while unsigned applications will have the following restrictions:
Node.mousePressed/mouseReleased/mouseClicked
) or keyboard
(Node.keyPressed/keyReleased/keyTyped
) event handlers. It is
not allowed to enter FSEM in response to ESC
key. Attempting to enter FSEM from any other context will result in
emulated full-screen mode.
If Stage
was constructed as full-screen but not visible
it will enter full-screen mode upon becoming visible, with the same
limitations to when this is allowed to happen as when setting
fullScreen
to true
.
UP, DOWN, LEFT, RIGHT, SPACE, TAB, PAGE_UP, PAGE_DOWN, HOME, END, ENTER
public final boolean isFullScreen()
Stage
should be a full-screen,
undecorated window.
The implementation of full-screen mode is platform and profile-dependent.
When set to true
, the Stage
will attempt to enter
full-screen mode when visible. Set to false
to return Stage
to windowed mode.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.
The full-screen mode will be exited (and the fullScreen
attribute
will be set to false
) if the full-screen
Stage
loses focus or if another Stage
enters
full-screen mode on the same Screen
. Note that a Stage
in full-screen mode can become invisible without losing its
full-screen status and will again enter full-screen mode when the
Stage
becomes visible.
Screen
the Stage will enter full-screen mode on by
setting its position to be within the bounds of that Screen
prior to entering full-screen mode.
However once in full-screen mode, Stage
's x
, y
,
width
, and height
variables will continue to represent
the non-full-screen position and size of the window; the same for
iconified
, resizable
, style
, and opacity
. If changes are made to any of these attributes while in
full-screen mode, upon exiting full-screen mode the Stage
will
assume those attributes.
For desktop profile the runtime will attempt to enter full-screen exclusive mode (FSEM) if such is supported by the platform and it is allowed for this application. If either is not the case a simulated full-screen window will be used instead; the window will be maximized, made undecorated if possible, and moved to the front.
The user can unconditionally exit full-screen mode at any time by pressingESC
.
There are differences in behavior between signed and unsigned applications. Signed applications are allowed to enter full-screen exclusive mode unrestricted while unsigned applications will have the following restrictions:
Node.mousePressed/mouseReleased/mouseClicked
) or keyboard
(Node.keyPressed/keyReleased/keyTyped
) event handlers. It is
not allowed to enter FSEM in response to ESC
key. Attempting to enter FSEM from any other context will result in
emulated full-screen mode.
If Stage
was constructed as full-screen but not visible
it will enter full-screen mode upon becoming visible, with the same
limitations to when this is allowed to happen as when setting
fullScreen
to true
.
UP, DOWN, LEFT, RIGHT, SPACE, TAB, PAGE_UP, PAGE_DOWN, HOME, END, ENTER
public final ReadOnlyBooleanProperty fullScreenProperty()
Stage
should be a full-screen,
undecorated window.
The implementation of full-screen mode is platform and profile-dependent.
When set to true
, the Stage
will attempt to enter
full-screen mode when visible. Set to false
to return Stage
to windowed mode.
An IllegalStateException
is thrown if this property is set
on a thread other than the JavaFX Application Thread.
The full-screen mode will be exited (and the fullScreen
attribute
will be set to false
) if the full-screen
Stage
loses focus or if another Stage
enters
full-screen mode on the same Screen
. Note that a Stage
in full-screen mode can become invisible without losing its
full-screen status and will again enter full-screen mode when the
Stage
becomes visible.
Screen
the Stage will enter full-screen mode on by
setting its position to be within the bounds of that Screen
prior to entering full-screen mode.
However once in full-screen mode, Stage
's x
, y
,
width
, and height
variables will continue to represent
the non-full-screen position and size of the window; the same for
iconified
, resizable
, style
, and opacity
. If changes are made to any of these attributes while in
full-screen mode, upon exiting full-screen mode the Stage
will
assume those attributes.
For desktop profile the runtime will attempt to enter full-screen exclusive mode (FSEM) if such is supported by the platform and it is allowed for this application. If either is not the case a simulated full-screen window will be used instead; the window will be maximized, made undecorated if possible, and moved to the front.
The user can unconditionally exit full-screen mode at any time by pressingESC
.
There are differences in behavior between signed and unsigned applications. Signed applications are allowed to enter full-screen exclusive mode unrestricted while unsigned applications will have the following restrictions:
Node.mousePressed/mouseReleased/mouseClicked
) or keyboard
(Node.keyPressed/keyReleased/keyTyped
) event handlers. It is
not allowed to enter FSEM in response to ESC
key. Attempting to enter FSEM from any other context will result in
emulated full-screen mode.
If Stage
was constructed as full-screen but not visible
it will enter full-screen mode upon becoming visible, with the same
limitations to when this is allowed to happen as when setting
fullScreen
to true
.
UP, DOWN, LEFT, RIGHT, SPACE, TAB, PAGE_UP, PAGE_DOWN, HOME, END, ENTER
isFullScreen()
,
setFullScreen(boolean)
public final ObservableList<Image> getIcons()
public final void setTitle(java.lang.String value)
Stage
.public final java.lang.String getTitle()
Stage
.public final StringProperty titleProperty()
Stage
.getTitle()
,
setTitle(String)
public final void setIconified(boolean value)
Stage
is iconified or not.public final boolean isIconified()
Stage
is iconified or not.public final ReadOnlyBooleanProperty iconifiedProperty()
Stage
is iconified or not.isIconified()
,
setIconified(boolean)
public final void setResizable(boolean value)
Stage
is resizable or not by the user.
Programatically you may still change the size of the Stage. This is
a hint which allows the implementation to optionally make the Stage
resizable by the user.public final boolean isResizable()
Stage
is resizable or not by the user.
Programatically you may still change the size of the Stage. This is
a hint which allows the implementation to optionally make the Stage
resizable by the user.public final BooleanProperty resizableProperty()
Stage
is resizable or not by the user.
Programatically you may still change the size of the Stage. This is
a hint which allows the implementation to optionally make the Stage
resizable by the user.isResizable()
,
setResizable(boolean)
public void toFront()
Window
to the foreground. If the Window
is
already in the foreground there is no visible difference.public void toBack()
Window
to the background. If the Window
is
already in the background there is no visible difference. This action
places this Window
at the bottom of the stacking order on
platforms that support stacking.public void close()
Stage
.
This call is equivalent to hide()
.Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. Use is subject to