Top Description Fields Constructors Methods
com.dlsc.gemsfx

public Class GlassPane

extends StackPane
Class Inheritance
Imports
javafx.animation.Animation.Status, .FadeTransition, javafx.beans.property.*, javafx.scene.layout.StackPane, javafx.util.Duration, java.util.Objects

A simple pane that can be used to overlay the UI with a semi-transparent color, indicating that input is blocked. The glass pane can be animated, which means it will fade in / fade out when it becomes visible or invisible.

Field Summary

Modifier and TypeField and Description
private final DoubleProperty
private final BooleanProperty
private final ObjectProperty<Duration>
private final FadeTransition
private final BooleanProperty

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final DoubleProperty

Returns:

the opacity of the glass pane
blockingOpacityProperty
()

The opacity value between 0 and 1 that will be used to gray out the content over which the glass pane is place.

public final ObjectProperty<Duration>

Returns:

the animation duration in milliseconds
fadeInOutDurationProperty
()

Stores the duration of the fade in / fade out animation.

public final BooleanProperty

Returns:

true if the fade in / out process will be animated
fadeInOutProperty
()

A property that determines whether we want to use a fade in / out animation of the glass pane when it gets shown or hidden.

public final double
public final Duration
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final BooleanProperty

Returns:

true if the pane is currently hidden
hideProperty
()

Controls whether the glass pane is hidden or shown.

public final boolean
public final boolean
public final void
setBlockingOpacity(double blockingOpacity)

public final void
setFadeInOut(boolean fadeInOut)

public final void
setFadeInOutDuration(Duration fadeInOutDuration)

public final void
setHide(boolean hide)

Inherited from javafx.scene.layout.StackPane:
alignmentPropertyclearConstraintscomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthgetAlignmentgetAlignmentgetClassCssMetaDatagetContentBiasgetCssMetaDatagetMarginlayoutChildrenrequestLayoutsetAlignmentsetAlignmentsetMargin

Field Detail

blockingOpacityback to summary
private final DoubleProperty blockingOpacity
fadeInOutback to summary
private final BooleanProperty fadeInOut
fadeInOutDurationback to summary
private final ObjectProperty<Duration> fadeInOutDuration
fadeTransitionback to summary
private final FadeTransition fadeTransition
hideback to summary
private final BooleanProperty hide

Constructor Detail

GlassPaneback to summary
public GlassPane()

Method Detail

blockingOpacityPropertyback to summary
public final DoubleProperty blockingOpacityProperty()

The opacity value between 0 and 1 that will be used to gray out the content over which the glass pane is place. A separate opacity property is needed to support the fade in / fade out animation AND the regular opacity.

Returns:DoubleProperty

the opacity of the glass pane

fadeInOutDurationPropertyback to summary
public final ObjectProperty<Duration> fadeInOutDurationProperty()

Stores the duration of the fade in / fade out animation.

Returns:ObjectProperty<Duration>

the animation duration in milliseconds

fadeInOutPropertyback to summary
public final BooleanProperty fadeInOutProperty()

A property that determines whether we want to use a fade in / out animation of the glass pane when it gets shown or hidden.

Returns:BooleanProperty

true if the fade in / out process will be animated

See Also
fadeInOutDurationProperty()
getBlockingOpacityback to summary
public final double getBlockingOpacity()
getFadeInOutDurationback to summary
public final Duration getFadeInOutDuration()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
hidePropertyback to summary
public final BooleanProperty hideProperty()

Controls whether the glass pane is hidden or shown.

Returns:BooleanProperty

true if the pane is currently hidden

isFadeInOutback to summary
public final boolean isFadeInOut()
isHideback to summary
public final boolean isHide()
setBlockingOpacityback to summary
public final void setBlockingOpacity(double blockingOpacity)
setFadeInOutback to summary
public final void setFadeInOut(boolean fadeInOut)
setFadeInOutDurationback to summary
public final void setFadeInOutDuration(Duration fadeInOutDuration)
setHideback to summary
public final void setHide(boolean hide)