Spec-Zone.ru › OpenJavaFX 8
javafx.stage

Class Window

java.lang.Object
  • javafx.stage.Window

All Implemented Interfaces:

EventTarget

Direct Known Subclasses:

PopupWindow, Stage



public class Window
extends Object
implements EventTarget

A top level window within which a scene is hosted, and with which the user interacts. A Window might be a Stage, PopupWindow, or other such top level. A Window is used also for browser plug-in based deployments.

Since:

JavaFX 2.0

  • Property Summary

    All MethodsInstance MethodsConcrete Methods
    Type Property and Description
    ObjectProperty<EventDispatcher> eventDispatcher
    Specifies the event dispatcher for this node.
    ReadOnlyBooleanProperty focused
    Whether or not this Window has the keyboard or input focus.
    ReadOnlyDoubleProperty height
    The height of this Stage.
    ObjectProperty<EventHandler<WindowEvent>> onCloseRequest
    Called when there is an external request to close this Window.
    ObjectProperty<EventHandler<WindowEvent>> onHidden
    Called just after the Window has been hidden.
    ObjectProperty<EventHandler<WindowEvent>> onHiding
    Called just prior to the Window being hidden.
    ObjectProperty<EventHandler<WindowEvent>> onShowing
    Called just prior to the Window being shown.
    ObjectProperty<EventHandler<WindowEvent>> onShown
    Called just after the Window is shown.
    DoubleProperty opacity
    Defines the opacity of the Stage as a value between 0.0 and 1.0.
    ReadOnlyObjectProperty<Scene> scene
    The Scene to be rendered on this Stage.
    ReadOnlyBooleanProperty showing
    Whether or not this Stage is showing (that is, open on the user's system).
    ReadOnlyDoubleProperty width
    The width of this Stage.
    ReadOnlyDoubleProperty x
    The horizontal location of this Stage on the screen.
    ReadOnlyDoubleProperty y
    The vertical location of this Stage on the screen.
  • Constructor Summary

    Constructors
    Modifier Constructor and Description
    protected Window()
  • Method Summary

    All MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    <T extends Event>
    void
    addEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
    Registers an event filter to this node.
    <T extends Event>
    void
    addEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
    Registers an event handler to this node.
    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.
    ObjectProperty<EventDispatcher> eventDispatcherProperty()
    Specifies the event dispatcher for this node.
    void fireEvent(Event event)
    Fires the specified event.
    ReadOnlyBooleanProperty focusedProperty()
    Whether or not this Window has the keyboard or input focus.
    EventDispatcher getEventDispatcher()
    Gets the value of the property eventDispatcher.
    double getHeight()
    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.
    double getOpacity()
    Gets the value of the property opacity.
    ObservableMap<Object,Object> getProperties()
    Returns an observable map of properties on this node for use primarily by application developers.
    Scene getScene()
    Gets the value of the property scene.
    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.
    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 Stage.
    void hide()
    Attempts to hide this Window by setting the visibility to false.
    boolean isFocused()
    Gets the value of the property focused.
    boolean isShowing()
    Gets the value of the property showing.
    ObjectProperty<EventHandler<WindowEvent>> onCloseRequestProperty()
    Called when there is an external request to close this Window.
    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.
    DoubleProperty opacityProperty()
    Defines the opacity of the Stage as a value between 0.0 and 1.0.
    <T extends Event>
    void
    removeEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
    Unregisters a previously registered event filter from this node.
    <T extends Event>
    void
    removeEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
    Unregisters a previously registered event handler from this node.
    void requestFocus()
    Requests that this Window get the input focus.
    ReadOnlyObjectProperty<Scene> sceneProperty()
    The Scene to be rendered on this Stage.
    void setEventDispatcher(EventDispatcher value)
    Sets the value of the property eventDispatcher.
    protected <T extends Event>
    void
    setEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
    Sets the handler to use for this event type.
    void setHeight(double value)
    Sets the value of the property height.
    void setOnCloseRequest(EventHandler<WindowEvent> value)
    Sets the value of the property onCloseRequest.
    void setOnHidden(EventHandler<WindowEvent> value)
    Sets the value of the property onHidden.
    void setOnHiding(EventHandler<WindowEvent> value)
    Sets the value of the property onHiding.
    void setOnShowing(EventHandler<WindowEvent> value)
    Sets the value of the property onShowing.
    void setOnShown(EventHandler<WindowEvent> value)
    Sets the value of the property onShown.
    void setOpacity(double value)
    Sets the value of the property opacity.
    protected void setScene(Scene value)
    Sets the value of the property scene.
    void setUserData(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.
    void setY(double value)
    Sets the value of the property y.
    protected void show()
    Attempts to show this Window by setting visibility to true
    ReadOnlyBooleanProperty showingProperty()
    Whether or not this Stage 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.
    ReadOnlyDoubleProperty widthProperty()
    The width of this Stage.
    ReadOnlyDoubleProperty xProperty()
    The horizontal location of this Stage on the screen.
    ReadOnlyDoubleProperty yProperty()
    The vertical location of this Stage on the screen.
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Detail

    • x

      public final ReadOnlyDoubleProperty xProperty
      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.

      See Also:

      getX(), setX(double)

    • y

      public final ReadOnlyDoubleProperty yProperty
      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.

      See Also:

      getY(), setY(double)

    • width

      public final ReadOnlyDoubleProperty widthProperty
      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.

      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)

    • height

      public final ReadOnlyDoubleProperty heightProperty
      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 Scene height instead.

      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)

    • focused

      public final ReadOnlyBooleanProperty focusedProperty
      Whether or not this 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.

      See Also:

      isFocused(), setFocused(boolean)

    • scene

      public final ReadOnlyObjectProperty<Scene> sceneProperty
      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. An IllegalStateException is thrown if this property is set on a thread other than the JavaFX Application Thread.

      Default value:

      null

      See Also:

      getScene(), setScene(Scene)

    • opacity

      public final DoubleProperty opacityProperty
      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.

      Default value:

      1.0

      See Also:

      getOpacity(), setOpacity(double)

    • onCloseRequest

      public final ObjectProperty<EventHandler<WindowEvent>> onCloseRequestProperty
      Called when there is an external request to close this Window. The installed event handler can prevent window closing by consuming the received event.

      See Also:

      getOnCloseRequest(), setOnCloseRequest(EventHandler)

    • onShowing

      public final ObjectProperty<EventHandler<WindowEvent>> onShowingProperty
      Called just prior to the Window being shown.

      See Also:

      getOnShowing(), setOnShowing(EventHandler)

    • onShown

      public final ObjectProperty<EventHandler<WindowEvent>> onShownProperty
      Called just after the Window is shown.

      See Also:

      getOnShown(), setOnShown(EventHandler)

    • onHiding

      public final ObjectProperty<EventHandler<WindowEvent>> onHidingProperty
      Called just prior to the Window being hidden.

      See Also:

      getOnHiding(), setOnHiding(EventHandler)

    • onHidden

      public final ObjectProperty<EventHandler<WindowEvent>> onHiddenProperty
      Called just after the Window has been hidden. When the Window is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the Window is closed.

      See Also:

      getOnHidden(), setOnHidden(EventHandler)

    • showing

      public final ReadOnlyBooleanProperty showingProperty
      Whether or not this Stage is showing (that is, open on the user's system). The Stage might be "showing", yet the user might not be able to see it due to the Stage being rendered behind another window or due to the Stage being positioned off the monitor.

      Default value:

      false

      See Also:

      isShowing()

    • eventDispatcher

      public final ObjectProperty<EventDispatcher> eventDispatcherProperty
      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.

      See Also:

      getEventDispatcher(), setEventDispatcher(EventDispatcher)

  • Constructor Detail

    • Window

      protected Window()
  • Method Detail

    • sizeToScene

      public void sizeToScene()
      Set the width and height of this Window to match the size of the content of this Window's Scene.
    • centerOnScreen

      public 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.
    • setX

      public final void setX(double value)
      Sets the value of the property x.

      Property description:

      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.

    • getX

      public final double getX()
      Gets the value of the property x.

      Property description:

      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.

    • xProperty

      public final ReadOnlyDoubleProperty xProperty()
      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.

      See Also:

      getX(), setX(double)

    • setY

      public final void setY(double value)
      Sets the value of the property y.

      Property description:

      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.

    • getY

      public final double getY()
      Gets the value of the property y.

      Property description:

      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.

    • yProperty

      public final ReadOnlyDoubleProperty yProperty()
      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.

      See Also:

      getY(), setY(double)

    • setWidth

      public final void setWidth(double value)
      Sets the value of the property width.

      Property description:

      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.

      The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.

    • getWidth

      public final double getWidth()
      Gets the value of the property width.

      Property description:

      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.

      The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.

    • widthProperty

      public final ReadOnlyDoubleProperty widthProperty()
      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.

      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)

    • setHeight

      public final void setHeight(double value)
      Sets the value of the property height.

      Property description:

      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 Scene height instead.

      The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.

    • getHeight

      public final double getHeight()
      Gets the value of the property height.

      Property description:

      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 Scene height instead.

      The property is read only because it can be changed externally by the underlying platform and therefore must not be bindable.

    • heightProperty

      public final ReadOnlyDoubleProperty heightProperty()
      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 Scene height instead.

      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)

    • requestFocus

      public final void requestFocus()
      Requests that this Window get the input focus.
    • isFocused

      public final boolean isFocused()
      Gets the value of the property focused.

      Property description:

      Whether or not this 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.

    • focusedProperty

      public final ReadOnlyBooleanProperty focusedProperty()
      Whether or not this 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.

      See Also:

      isFocused(), setFocused(boolean)

    • getProperties

      public final ObservableMap<Object,Object> getProperties()
      Returns 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

    • hasProperties

      public boolean hasProperties()
      Tests if Window has properties.

      Returns:

      true if node has properties.

      Since:

      JavaFX 8u40

    • setUserData

      public void setUserData(Object value)
      Convenience 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 calling getUserData().

      Parameters:

      value - The value to be stored - this can later be retrieved by calling getUserData().

      Since:

      JavaFX 8u40

    • getUserData

      public Object getUserData()
      Returns a previously set Object property, or null if no such property has been set using the setUserData(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

    • setScene

      protected void setScene(Scene value)
      Sets the value of the property scene.

      Property description:

      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. An IllegalStateException is thrown if this property is set on a thread other than the JavaFX Application Thread.

      Default value:

      null

    • getScene

      public final Scene getScene()
      Gets the value of the property scene.

      Property description:

      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. An IllegalStateException is thrown if this property is set on a thread other than the JavaFX Application Thread.

      Default value:

      null

    • sceneProperty

      public final ReadOnlyObjectProperty<Scene> sceneProperty()
      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. An IllegalStateException is thrown if this property is set on a thread other than the JavaFX Application Thread.

      Default value:

      null

      See Also:

      getScene(), setScene(Scene)

    • setOpacity

      public final void setOpacity(double value)
      Sets the value of the property opacity.

      Property description:

      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.

      Default value:

      1.0

    • getOpacity

      public final double getOpacity()
      Gets the value of the property opacity.

      Property description:

      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.

      Default value:

      1.0

    • opacityProperty

      public final DoubleProperty opacityProperty()
      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.

      Default value:

      1.0

      See Also:

      getOpacity(), setOpacity(double)

    • setOnCloseRequest

      public final void setOnCloseRequest(EventHandler<WindowEvent> value)
      Sets 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.

    • getOnCloseRequest

      public final EventHandler<WindowEvent> getOnCloseRequest()
      Gets 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.

    • onCloseRequestProperty

      public final ObjectProperty<EventHandler<WindowEvent>> onCloseRequestProperty()
      Called when there is an external request to close this Window. The installed event handler can prevent window closing by consuming the received event.

      See Also:

      getOnCloseRequest(), setOnCloseRequest(EventHandler)

    • setOnShowing

      public final void setOnShowing(EventHandler<WindowEvent> value)
      Sets the value of the property onShowing.

      Property description:

      Called just prior to the Window being shown.

    • getOnShowing

      public final EventHandler<WindowEvent> getOnShowing()
      Gets the value of the property onShowing.

      Property description:

      Called just prior to the Window being shown.

    • onShowingProperty

      public final ObjectProperty<EventHandler<WindowEvent>> onShowingProperty()
      Called just prior to the Window being shown.

      See Also:

      getOnShowing(), setOnShowing(EventHandler)

    • setOnShown

      public final void setOnShown(EventHandler<WindowEvent> value)
      Sets the value of the property onShown.

      Property description:

      Called just after the Window is shown.

    • getOnShown

      public final EventHandler<WindowEvent> getOnShown()
      Gets the value of the property onShown.

      Property description:

      Called just after the Window is shown.

    • onShownProperty

      public final ObjectProperty<EventHandler<WindowEvent>> onShownProperty()
      Called just after the Window is shown.

      See Also:

      getOnShown(), setOnShown(EventHandler)

    • setOnHiding

      public final void setOnHiding(EventHandler<WindowEvent> value)
      Sets the value of the property onHiding.

      Property description:

      Called just prior to the Window being hidden.

    • getOnHiding

      public final EventHandler<WindowEvent> getOnHiding()
      Gets the value of the property onHiding.

      Property description:

      Called just prior to the Window being hidden.

    • onHidingProperty

      public final ObjectProperty<EventHandler<WindowEvent>> onHidingProperty()
      Called just prior to the Window being hidden.

      See Also:

      getOnHiding(), setOnHiding(EventHandler)

    • setOnHidden

      public final void setOnHidden(EventHandler<WindowEvent> value)
      Sets the value of the property onHidden.

      Property description:

      Called just after the Window has been hidden. When the 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

      public final EventHandler<WindowEvent> getOnHidden()
      Gets the value of the property onHidden.

      Property description:

      Called just after the Window has been hidden. When the Window is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the Window is closed.

    • onHiddenProperty

      public final ObjectProperty<EventHandler<WindowEvent>> onHiddenProperty()
      Called just after the Window has been hidden. When the Window is hidden, this event handler is invoked allowing the developer to clean up resources or perform other tasks when the Window is closed.

      See Also:

      getOnHidden(), setOnHidden(EventHandler)

    • isShowing

      public final boolean isShowing()
      Gets the value of the property showing.

      Property description:

      Whether or not this Stage is showing (that is, open on the user's system). The Stage might be "showing", yet the user might not be able to see it due to the Stage being rendered behind another window or due to the Stage being positioned off the monitor.

      Default value:

      false

    • showingProperty

      public final ReadOnlyBooleanProperty showingProperty()
      Whether or not this Stage is showing (that is, open on the user's system). The Stage might be "showing", yet the user might not be able to see it due to the Stage being rendered behind another window or due to the Stage being positioned off the monitor.

      Default value:

      false

      See Also:

      isShowing()

    • show

      protected 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.

    • hide

      public 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.

    • setEventDispatcher

      public final void setEventDispatcher(EventDispatcher value)
      Sets 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.

    • getEventDispatcher

      public final EventDispatcher getEventDispatcher()
      Gets 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.

    • eventDispatcherProperty

      public final ObjectProperty<EventDispatcher> eventDispatcherProperty()
      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.

      See Also:

      getEventDispatcher(), setEventDispatcher(EventDispatcher)

    • addEventHandler

      public 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 an Event of 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

      Throws:

      NullPointerException - if the event type or handler is null

    • removeEventHandler

      public 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

      Throws:

      NullPointerException - if the event type or handler is null

    • addEventFilter

      public 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 an Event of 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

      Throws:

      NullPointerException - if the event type or filter is null

    • removeEventFilter

      public 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

      Throws:

      NullPointerException - if the event type or filter is null

    • setEventHandler

      protected 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

      Throws:

      NullPointerException - if the event type is null

    • fireEvent

      public final void fireEvent(Event event)
      Fires the specified event.

      This method must be called on the FX user thread.

      Parameters:

      event - the event to fire

    • buildEventDispatchChain

      public EventDispatchChain buildEventDispatchChain(EventDispatchChain tail)
      Construct an event dispatch chain for this window.

      Specified by:

      buildEventDispatchChain in interface EventTarget

      Parameters:

      tail - the initial chain to build from

      Returns:

      the resulting event dispatch chain for this window

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API