-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashScreen.java
More file actions
29 lines (22 loc) · 927 Bytes
/
SplashScreen.java
File metadata and controls
29 lines (22 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.example.hellofx;
import javafx.animation.PauseTransition;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;
public class SplashScreen extends StackPane {
public SplashScreen(Stage stage) {
Label logo = new Label("Doit");
logo.setStyle("-fx-font-size: 48px; -fx-text-fill: white;");
this.setStyle("-fx-background-color: linear-gradient(to bottom, #1e0036, #2a0070);");
this.getChildren().add(logo);
PauseTransition delay = new PauseTransition(Duration.seconds(2));
delay.setOnFinished(e -> {
AppState state = new AppState(); // ✅ shared state instance
CalendarScreen calendarScreen = new CalendarScreen(stage, state);
stage.setScene(new Scene(calendarScreen, 375, 812));
});
delay.play();
}
}