Skip to content

Commit

Permalink
Added a user agent stylesheet to GlassPane.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemmermann committed Dec 2, 2024
1 parent 4801a1a commit a65063f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gemsfx/src/main/java/com/dlsc/gemsfx/GlassPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import javafx.animation.Animation.Status;
import javafx.animation.FadeTransition;
import javafx.beans.property.*;
import javafx.geometry.Insets;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.util.Duration;

import 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
Expand All @@ -29,7 +26,6 @@ public GlassPane() {
}
});

setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
setMouseTransparent(false);
setVisible(false);

Expand Down Expand Up @@ -59,6 +55,11 @@ public GlassPane() {
});
}

@Override
public String getUserAgentStylesheet() {
return Objects.requireNonNull(GlassPane.class.getResource("glass-pane.css")).toExternalForm();
}

private final DoubleProperty blockingOpacity = new SimpleDoubleProperty(this, "blockingOpacity", .5);

public final double getBlockingOpacity() {
Expand Down

0 comments on commit a65063f

Please sign in to comment.