Spec-Zone .ru
спецификации, руководства, описания, API

JavaFX: Bringing Rich Experiences To All the Screens Of Your Life

Profile: desktop, common

Overview

The JavaFX Stage class is the top level container for the FX script instantiation.

Example:


    import javafx.scene.Scene;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    Stage {
    title: "Welcome to JavaFX!"
    scene: Scene {
    content: Text {
    x: 25
    y: 25
    content: "Hello World!"
    font: Font{ size: 32 }
    }
    }
    }

produces the following on Mac OSX:

produces the following on Windows XP:

produces the following on Windows Vista:

Profile: common

Script Variable Summary

access name type Can Read Can Init Can Write Default Value description

Variable Summary

access name type Can Read Can Init Can Write Default Value description
public-read containsFocus Boolean

Whether or not this Stage has the keyboard or input focus.

public extensions StageExtension[] empty

The extensions that a Stage may have depending on the target profile of the script.

The extensions that a Stage may have depending on the target profile of the script. For example, on desktop platforms you may use an AppletStageExtension for additional APIs specific to the Applet deployment target.

empty

See Also:
AppletStageExtension

Profile: common

 
public fullScreen Boolean false

Specifies whether this Stage should be a full-screen, undecorated window.

Specifies whether this 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.

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.

If the platform supports multiple screens an application can control which 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.

Notes regarding desktop profile implementation.

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 pressing ESC.

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:

  • Applications can only enter FSEM in response to user input. More specifically, entering is allowed from mouse (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.

  • If the application was allowed to enter FSEM it will have limited keyboard input. It will only receive events from the following keys: UP, DOWN, LEFT, RIGHT, SPACE, TAB, PAGE_UP, PAGE_DOWN, HOME, END, ENTER

false

Profile: common

 
public height Number

The height of this Stage.

The height of this Stage. Changing this attribute will shrink or heighten the height of the Stage. Changing this attribute will not visually affect a Stage while fullScreen is true, but will be honored by the Stage once fullScreen becomes false. 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 Stage height instead.

Profile: common

 
public iconified Boolean false

Defines whether the Stage is iconified or not.

public icons Image[] empty

Defines the icon images to be used in the window decorations and when minimized.

Defines the icon images to be used in the window decorations and when minimized. The images should be different sizes of the same image and the best size will be chosen, eg. 16x16, 32,32.

empty

Profile: common

 
public onClose function():Void

When the Stage is closed, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the Stage is closed.

public opacity Number 1.0

Defines the opacity of the Stage as a value between 0.0 and 1.0.

Defines the opacity of the Stage as a value between 0.0 and 1.0. The opacity is reflected across the Stage, 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 Stage with 0% opacity is fully translucent. Typically, a Stage with 0% opacity will not receive any mouse events.

1.0

Profile: common

 
public resizable Boolean true

Defines whether the Stage is resizable or not by the user.

Defines whether the 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.

true

Profile: common

 
public scene Scene null

The Scene to be rendered on this Stage.

The Scene to be rendered on this Stage. There can only be one Scene on the Stage at a time, and a Scene can only be on one Stage at a time. Setting a Scene on a different Stage will cause the old Stage to lose the reference before the new one gains it. You may swap Scenes on a Stage at any time, even while in full-screen exclusive mode.

null

Profile: common

 
public-init style StageStyle StageStyle.DECORATED

Defines the StageStyle of the Stage.

Defines the StageStyle of the Stage. For platforms that do not support the StageStyle decoration setting this variable has no effect.

StageStyle.DECORATED

Profile: common

 
public title String empty string

Defines the title of the Stage.

public visible Boolean true

Whether or not this Stage is visible.

Whether or not this Stage is visible. Setting the visibility of a Stage to false does not automatically close the Stage.

true

Profile: common

 
public width Number

The width of this Stage.

The width of this Stage. Changing this attribute will narrow or widen the width of the Stage. Changing this attribute will not visually affect a Stage while fullScreen is true, but will be honored by the Stage once fullScreen becomes false. 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 Scene width instead.

Profile: common

 
public x Number

The horizontal location of this Stage on the screen.

The horizontal location of this Stage on the screen. Changing this attribute will move the Stage horizontally. Changing this attribute will not visually affect a Stage while fullScreen is true, but will be honored by the Stage once fullScreen becomes false.

Profile: common

 
public y Number

The vertical location of this Stage on the screen.

The vertical location of this Stage on the screen. Changing this attribute will move the Stage vertically. Changing this attribute will not visually affect a Stage while fullScreen is true, but will be honored by the Stage once fullScreen becomes false.

Profile: common

 

Inherited Variables

Function Summary

public close() : Void

Close the Stage and trigger the onClose close action.

Close the Stage and trigger the onClose close action.

Closing a Stage will prevent it from being made visible again, it's resources are disposed and no longer available.

The close() function may only be called once on a Stage and any subsequent calls are ignored

.

Profile: common

 
public impl_getPeer() : com.sun.javafx.tk.TKStage

Get Stage's Peer (implementation)

Get Stage's Peer (implementation)

Returns
TKStage
 
public impl_setContainsFocus(b: Boolean) : Void

Used for testing

Used for testing

Parameters
b
 
public toBack() : Void

Send the Stage to the background.

Send the Stage to the background. If the Stage is already in the background there is no visible difference. This action places this Stage at the bottom of the stacking order on platforms that support stacking.

Profile: common

 
public toFront() : Void

Bring the Stage to the foreground.

Bring the Stage to the foreground. If the Stage is already in the foreground there is no visible difference.

Profile: common

 

Inherited Functions