-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDriver.java
More file actions
63 lines (56 loc) · 1.82 KB
/
Driver.java
File metadata and controls
63 lines (56 loc) · 1.82 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package cs3500.pa05;
import cs3500.pa05.controller.WelcomeController;
import cs3500.pa05.view.BujoView;
import javafx.animation.PauseTransition;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import javafx.util.Duration;
/**
* Represents an interactive bullet journal with a GUI.
*/
public class Driver extends Application {
/**
* Starts the GUI for a simple interactive journal.
*
* @param primaryStage the JavaFX stage to add elements to
*/
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
root.setStyle("-fx-background-color: #1B03A3");
Scene scene = new Scene(root, 400, 300);
primaryStage.setScene(scene);
primaryStage.show();
PauseTransition pause = new PauseTransition(Duration.seconds(2));
pause.setOnFinished(e -> {
Platform.runLater(() -> {
// Code executed on the JavaFX Application Thread
// instantiate a simple welcome GUI view
WelcomeController welcomeController = new WelcomeController(primaryStage);
BujoView view = new BujoView(welcomeController, "Welcome.fxml");
try {
// load and place the view's scene onto the stage
primaryStage.setScene(view.load());
primaryStage.setTitle("Welcome");
welcomeController.run();
// render the stage
primaryStage.show();
} catch (IllegalStateException exc) {
System.err.println("Unable to load GUI.");
}
});
});
pause.play();
}
/**
* Runs a GUI application.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
Application.launch();
}
}