Class Window

java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.control.Control
jfxtras.scene.control.window.Window
All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget, javafx.scene.control.Skinnable, SelectableNode

public class Window extends javafx.scene.control.Control implements SelectableNode
Window control. A window control is a window node as known from Swing, e.g javax.swing.JInternalFrame. It can be used to realize MDI based applications. See https://github.com/miho/VFXWindows-Samples for sample code.
Author:
Michael Hoffer <info@michaelhoffer.de>
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ObjectProperty<javafx.animation.Transition>
    Returns the "close-transition" property.
    javafx.beans.property.Property<javafx.scene.layout.Pane>
    Content pane property.
    javafx.beans.property.BooleanProperty
    Returns the minimize property.
    javafx.beans.property.BooleanProperty
    Returns the movable property.
    javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>>
    Returns the "on-close-action" property.
    javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>>
    Returns the "on-closed-action" property.
    javafx.beans.property.DoubleProperty
    Returns the resizable border width property.
    javafx.beans.property.BooleanProperty
    Returns the resize property.
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.ReadOnlyBooleanProperty
     
    javafx.beans.property.StringProperty
    Returns the titlebar style class property.
    final javafx.beans.property.StringProperty
    Returns the window title property.

    Properties inherited from class javafx.scene.control.Control

    contextMenu, skin, tooltip

    Properties inherited from class javafx.scene.layout.Region

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent

    needsLayout

    Properties inherited from class javafx.scene.Node

    accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Default css style.
    static final String
    Default style class for css.

    Fields inherited from class javafx.scene.layout.Region

    USE_COMPUTED_SIZE, USE_PREF_SIZE

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
    Window(String title)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes this window.
    javafx.beans.property.ObjectProperty<javafx.animation.Transition>
    Returns the "close-transition" property.
    javafx.beans.property.Property<javafx.scene.layout.Pane>
    Content pane property.
    javafx.animation.Transition
    Returns the transition that shall be used to indicate window closing.
    javafx.scene.layout.Pane
     
    javafx.collections.ObservableList<WindowIcon>
    Returns a list that contains the icons that are placed on the left side of the titlebar.
    javafx.event.EventHandler<javafx.event.ActionEvent>
    Returns the action that shall be performed before the window will be closed.
    javafx.event.EventHandler<javafx.event.ActionEvent>
    Returns the action that shall be performed after the window has been closed.
    double
    Returns the width of the "resizable border" of the window.
    javafx.collections.ObservableList<WindowIcon>
    Returns a list that contains the icons that are placed on the right side of the titlebar.
    final String
    Returns the window title.
    Returns the CSS style class of the titlebar.
     
    boolean
    Indicates whether the window is currently minimized.
    boolean
    Indicates whether the window is movable.
    boolean
    Indicates whether the window shall be moved to front when a user clicks on the window.
    boolean
    Indicates whether the window is resizeable by the user.
    boolean
    Gets the value of the selectable property.
    boolean
     
    javafx.beans.property.BooleanProperty
    Returns the minimize property.
    javafx.beans.property.BooleanProperty
    Returns the movable property.
    javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>>
    Returns the "on-close-action" property.
    javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>>
    Returns the "on-closed-action" property.
    boolean
    requestSelection(boolean select)
    Requests selection/deselection.
    javafx.beans.property.DoubleProperty
    Returns the resizable border width property.
    javafx.beans.property.BooleanProperty
    Returns the resize property.
    javafx.beans.property.BooleanProperty
     
    javafx.beans.property.ReadOnlyBooleanProperty
     
    void
    setCloseTransition(javafx.animation.Transition t)
    Defines the transition that shall be used to indicate window closing.
    void
    setContentPane(javafx.scene.layout.Pane contentPane)
    Defines the content pane of this window.
    void
    setMinimized(boolean v)
    Defines whether this window shall be minimized.
    void
    setMovable(boolean v)
    Defines whether this window shall be movable.
    void
    setMoveToFront(boolean moveToFront)
    Defines whether this window shall be moved to front when a user clicks on the window.
    void
    setOnCloseAction(javafx.event.EventHandler<javafx.event.ActionEvent> onClosedAction)
    Defines the action that shall be performed before the window will be closed.
    void
    setOnClosedAction(javafx.event.EventHandler<javafx.event.ActionEvent> onClosedAction)
    Defines the action that shall be performed after the window has been closed.
    void
    Defines the width of the "resizable border" of the window.
    void
    setResizableWindow(boolean v)
    Defines whether this window shall be resizeable by the user.
    void
    setSelectable(Boolean selectable)
    Sets the value of the selectable property.
    final void
    Defines the window title.
    void
    Defines the CSS style class of the titlebar.
    javafx.beans.property.StringProperty
    Returns the titlebar style class property.
    final javafx.beans.property.StringProperty
    Returns the window title property.

    Methods inherited from class javafx.scene.control.Control

    computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, createDefaultSkin, executeAccessibleAction, getBaselineOffset, getClassCssMetaData, getContextMenu, getControlCssMetaData, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinProperty, tooltipProperty

    Methods inherited from class javafx.scene.layout.Region

    backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthProperty

    Methods inherited from class javafx.scene.Parent

    getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds

    Methods inherited from class javafx.scene.Node

    accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

  • Field Details

  • Constructor Details

    • Window

      public Window()
      Constructor.
    • Window

      public Window(String title)
      Constructor.
      Parameters:
      title - window title
  • Method Details

    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class javafx.scene.layout.Region
    • getContentPane

      public javafx.scene.layout.Pane getContentPane()
      Returns:
      the content pane of this window
    • setContentPane

      public void setContentPane(javafx.scene.layout.Pane contentPane)
      Defines the content pane of this window.
      Parameters:
      contentPane - content pane to set
    • contentPaneProperty

      public javafx.beans.property.Property<javafx.scene.layout.Pane> contentPaneProperty()
      Content pane property.
      Returns:
      content pane property
      See Also:
    • setMoveToFront

      public void setMoveToFront(boolean moveToFront)
      Defines whether this window shall be moved to front when a user clicks on the window.
      Parameters:
      moveToFront - the state to set
    • isMoveToFront

      public boolean isMoveToFront()
      Indicates whether the window shall be moved to front when a user clicks on the window.
      Returns:
      true if the window shall be moved to front when a user clicks on the window; false otherwise
    • getTitle

      public final String getTitle()
      Returns the window title.
      Returns:
      the title
    • setTitle

      public final void setTitle(String title)
      Defines the window title.
      Parameters:
      title - the title to set
    • titleProperty

      public final javafx.beans.property.StringProperty titleProperty()
      Returns the window title property.
      Returns:
      the window title property
      See Also:
    • getLeftIcons

      public javafx.collections.ObservableList<WindowIcon> getLeftIcons()
      Returns a list that contains the icons that are placed on the left side of the titlebar. Add icons to the list to add them to the left side of the window titlebar.
      Returns:
      a list containing the left icons
      See Also:
    • getRightIcons

      public javafx.collections.ObservableList<WindowIcon> getRightIcons()
      Returns a list that contains the icons that are placed on the right side of the titlebar. Add icons to the list to add them to the right side of the window titlebar.
      Returns:
      a list containing the right icons
      See Also:
    • setMinimized

      public void setMinimized(boolean v)
      Defines whether this window shall be minimized.
      Parameters:
      v - the state to set
    • isMinimized

      public boolean isMinimized()
      Indicates whether the window is currently minimized.
      Returns:
      true if the window is currently minimized; false otherwise
    • minimizedProperty

      public javafx.beans.property.BooleanProperty minimizedProperty()
      Returns the minimize property.
      Returns:
      the minimize property
      See Also:
    • setResizableWindow

      public void setResizableWindow(boolean v)
      Defines whether this window shall be resizeable by the user.
      Parameters:
      v - the state to set
    • isResizableWindow

      public boolean isResizableWindow()
      Indicates whether the window is resizeable by the user.
      Returns:
      true if the window is resizeable; false otherwise
    • resizeableWindowProperty

      public javafx.beans.property.BooleanProperty resizeableWindowProperty()
      Returns the resize property.
      Returns:
      the minimize property
    • setMovable

      public void setMovable(boolean v)
      Defines whether this window shall be movable.
      Parameters:
      v - the state to set
    • isMovable

      public boolean isMovable()
      Indicates whether the window is movable.
      Returns:
      true if the window is movable; false otherwise
    • movableProperty

      public javafx.beans.property.BooleanProperty movableProperty()
      Returns the movable property.
      Returns:
      the minimize property
      See Also:
    • titleBarStyleClassProperty

      public javafx.beans.property.StringProperty titleBarStyleClassProperty()
      Returns the titlebar style class property.
      Returns:
      the titlebar style class property
      See Also:
    • setTitleBarStyleClass

      public void setTitleBarStyleClass(String name)
      Defines the CSS style class of the titlebar.
      Parameters:
      name - the CSS style class name
    • getTitleBarStyleClass

      public String getTitleBarStyleClass()
      Returns the CSS style class of the titlebar.
      Returns:
      the CSS style class of the titlebar
    • resizableBorderWidthProperty

      public javafx.beans.property.DoubleProperty resizableBorderWidthProperty()
      Returns the resizable border width property.
      Returns:
      the resizable border width property
      See Also:
    • setResizableBorderWidth

      public void setResizableBorderWidth(double v)
      Defines the width of the "resizable border" of the window. The resizable border is usually defined as a rectangular border around the layout bounds of the window where the mouse cursor changes to "resizable" and which allows to resize the window by performing a "dragging gesture", i.e., the user can "grab" the window border and change the size of the window.
      Parameters:
      v - border width
    • getResizableBorderWidth

      public double getResizableBorderWidth()
      Returns the width of the "resizable border" of the window.
      Returns:
      the width of the "resizable border" of the window
      See Also:
    • close

      public void close()
      Closes this window.
    • onClosedActionProperty

      public javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> onClosedActionProperty()
      Returns the "on-closed-action" property.
      Returns:
      the "on-closed-action" property.
      See Also:
    • setOnClosedAction

      public void setOnClosedAction(javafx.event.EventHandler<javafx.event.ActionEvent> onClosedAction)
      Defines the action that shall be performed after the window has been closed.
      Parameters:
      onClosedAction - the action to set
    • getOnClosedAction

      public javafx.event.EventHandler<javafx.event.ActionEvent> getOnClosedAction()
      Returns the action that shall be performed after the window has been closed.
      Returns:
      the action that shall be performed after the window has been closed or null if no such action has been defined
    • onCloseActionProperty

      public javafx.beans.property.ObjectProperty<javafx.event.EventHandler<javafx.event.ActionEvent>> onCloseActionProperty()
      Returns the "on-close-action" property.
      Returns:
      the "on-close-action" property.
      See Also:
    • setOnCloseAction

      public void setOnCloseAction(javafx.event.EventHandler<javafx.event.ActionEvent> onClosedAction)
      Defines the action that shall be performed before the window will be closed.
      Parameters:
      onClosedAction - the action to set
    • getOnCloseAction

      public javafx.event.EventHandler<javafx.event.ActionEvent> getOnCloseAction()
      Returns the action that shall be performed before the window will be closed.
      Returns:
      the action that shall be performed before the window will be closed or null if no such action has been defined
    • closeTransitionProperty

      public javafx.beans.property.ObjectProperty<javafx.animation.Transition> closeTransitionProperty()
      Returns the "close-transition" property.
      Returns:
      the "close-transition" property.
      See Also:
    • setCloseTransition

      public void setCloseTransition(javafx.animation.Transition t)
      Defines the transition that shall be used to indicate window closing.
      Parameters:
      t - the transition that shall be used to indicate window closing or null if no transition shall be used.
    • getCloseTransition

      public javafx.animation.Transition getCloseTransition()
      Returns the transition that shall be used to indicate window closing.
      Returns:
      the transition that shall be used to indicate window closing or null if no such transition has been defined
    • requestSelection

      public boolean requestSelection(boolean select)
      Description copied from interface: SelectableNode
      Requests selection/deselection.
      Specified by:
      requestSelection in interface SelectableNode
      Parameters:
      select - defines whether to select or deselect the node
      Returns:
      true if request is accepted;false otherwise
    • selectableProperty

      public javafx.beans.property.BooleanProperty selectableProperty()
      Returns:
      the selectableProperty
      See Also:
    • setSelectable

      public void setSelectable(Boolean selectable)
      Sets the value of the selectable property.
      Property description:
      Parameters:
      selectable - the value for the selectable property
      See Also:
    • isSelectable

      public boolean isSelectable()
      Gets the value of the selectable property.
      Property description:
      Returns:
      the value of the selectable property
      See Also:
    • selectedProperty

      public javafx.beans.property.ReadOnlyBooleanProperty selectedProperty()
      Returns:
      the selectedProperty
      See Also:
    • isSelected

      public boolean isSelected()
      Returns:
      true if the window is selected; false otherwise