-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainApp.java
More file actions
45 lines (36 loc) · 1.49 KB
/
MainApp.java
File metadata and controls
45 lines (36 loc) · 1.49 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
package ToDo.src;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class MainApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader eventLoader = new FXMLLoader(getClass().getResource("eventPage.fxml"));
Parent eventRoot = eventLoader.load();
EventPageController eventController = eventLoader.getController();
eventController.setOnEditButtonClicked(() -> {
try {
FXMLLoader editLoader = new FXMLLoader(getClass().getResource("editPage.fxml"));
Parent editRoot = editLoader.load();
EditPageController editController = editLoader.getController();
// Create a new scene for the Edit Page
Scene editScene = new Scene(editRoot);
// Set the scene on the primary stage
primaryStage.setScene(editScene);
primaryStage.setTitle("Edit Page");
primaryStage.show();
} catch (Exception e) {
e.printStackTrace();
}
});
Scene eventScene = new Scene(eventRoot);
primaryStage.setScene(eventScene);
primaryStage.setTitle("Event Page");
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}