1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package Launchers;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 import Controllers.AddYearController;
40 import Utilities.LogToFile;
41 import Utilities.Severity;
42 import javafx.fxml.FXMLLoader;
43 import javafx.scene.Scene;
44 import javafx.stage.Modality;
45 import javafx.stage.Stage;
46 import javafx.stage.Window;
47
48 import java.io.IOException;
49
50
51
52
53 public class AddYear extends Window {
54 public AddYear(Window owner) {
55 Stage stage = new Stage();
56 FXMLLoader loader;
57
58 Scene root;
59 try {
60 loader = new FXMLLoader(getClass().getResource("/UI/AddYear.fxml"));
61 root = new Scene(loader.load());
62 AddYearController addYearController = loader.getController();
63 addYearController.initAddYear(this);
64 stage.setScene(root);
65 stage.setTitle("Reports");
66 stage.initModality(Modality.APPLICATION_MODAL);
67 stage.initOwner(owner);
68 stage.showAndWait();
69 } catch (IOException e) {
70 LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
71 }
72
73 }
74
75 public AddYear(String year, Window owner) {
76 Stage stage = new Stage();
77 FXMLLoader loader;
78
79 Scene root;
80 try {
81 loader = new FXMLLoader(getClass().getResource("/UI/AddYear.fxml"));
82 root = new Scene(loader.load());
83 AddYearController addYearController = loader.getController();
84 addYearController.initAddYear(year, this);
85 stage.setScene(root);
86 stage.setTitle("Reports");
87 stage.initModality(Modality.APPLICATION_MODAL);
88 stage.initOwner(owner);
89 stage.showAndWait();
90 } catch (IOException e) {
91 LogToFile.log(e, Severity.SEVERE, "Error loading window. Please retry then reinstall application. If error persists, contact the developers.");
92 }
93
94 }
95 }