mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
changed how the layer background uses css
This commit is contained in:
@@ -13,18 +13,22 @@ public abstract class Layer {
|
|||||||
protected StackPane layer;
|
protected StackPane layer;
|
||||||
protected Region background;
|
protected Region background;
|
||||||
|
|
||||||
protected Layer(String cssFile) {
|
protected Layer(String cssFile, String backgroundCssClass) {
|
||||||
layer = new StackPane();
|
layer = new StackPane();
|
||||||
layer.setPickOnBounds(false);
|
layer.setPickOnBounds(false);
|
||||||
layer.getStylesheets().add(ResourceManager.get(CssAsset.class, cssFile).getUrl());
|
layer.getStylesheets().add(ResourceManager.get(CssAsset.class, cssFile).getUrl());
|
||||||
|
|
||||||
background = new Region();
|
background = new Region();
|
||||||
background.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
background.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);
|
||||||
background.getStyleClass().add("background");
|
background.getStyleClass().add(backgroundCssClass);
|
||||||
|
|
||||||
layer.getChildren().addLast(background);
|
layer.getChildren().addLast(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Layer(String cssFile) {
|
||||||
|
this(cssFile, "background");
|
||||||
|
}
|
||||||
|
|
||||||
protected void addContainer(Container container, Pos position, int xOffset, int yOffset) {
|
protected void addContainer(Container container, Pos position, int xOffset, int yOffset) {
|
||||||
StackPane.setAlignment(container.getContainer(), position);
|
StackPane.setAlignment(container.getContainer(), position);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import javafx.geometry.Pos;
|
|||||||
|
|
||||||
public final class QuitLayer extends Layer {
|
public final class QuitLayer extends Layer {
|
||||||
public QuitLayer() {
|
public QuitLayer() {
|
||||||
super("quit.css");
|
super("quit.css", "quit_background");
|
||||||
|
|
||||||
final Container mainContainer = Container.create(Container.Type.VERTICAL, 30);
|
final Container mainContainer = Container.create(Container.Type.VERTICAL, 30);
|
||||||
mainContainer.addText("Are you sure?");
|
mainContainer.addText("Are you sure?");
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.background {
|
||||||
|
-fx-background-color: linear-gradient(to bottom right, #21a7b2, #8f32b9);
|
||||||
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
-fx-background-color: linear-gradient(to bottom right, orange, indigo), #1d1d1d;
|
-fx-background-color: linear-gradient(to bottom right, orange, indigo), #1d1d1d;
|
||||||
-fx-background-insets: 0, 2;
|
-fx-background-insets: 0, 2;
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
.background {
|
|
||||||
-fx-background-color: linear-gradient(to bottom right, #21a7b2, #8f32b9);
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
.background {
|
.quit_background {
|
||||||
-fx-background-color: #0000007f;
|
-fx-background-color: #0000007f;
|
||||||
}
|
}
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
.background {
|
|
||||||
-fx-background-color: linear-gradient(to bottom right, #21a7b2, #8f32b9);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user