This repository has been archived by the owner on Apr 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
115 lines (89 loc) · 3.29 KB
/
Main.java
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package sample;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import sample.model.Course;
import sample.model.Person;
import sample.model.University;
import sample.controller.Registration;
import java.io.IOException;
public class Main extends Application {
private Stage stage;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
this.stage = primaryStage;
//login();
principal();
}
public void login() throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/Login.fxml"));
Scene scene = new Scene(loader.load());
stage = new Stage();
stage.setScene(scene);
stage.setTitle("Login");
stage.show();
}
public void principal() throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/Principal.fxml"));
Scene scene = new Scene(loader.load());
stage = new Stage();
stage.setScene(scene);
stage.setTitle("Principal");
stage.show();
}
public Person cadastro(Person person, ObservableList<String> courses , ObservableList<String> universitys) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/Registration.fxml"));
Scene scene = new Scene(loader.load());
Registration controller = loader.getController();
controller.setPersonObj(person);
controller.setCourseData(courses);
controller.setUniversityData(universitys);
stage = new Stage();
stage.setScene(scene);
stage.setTitle("Edit Person");
stage.initModality(Modality.WINDOW_MODAL);
stage.showAndWait();
return controller.getPersonObj();
}
public University cadastro(University university) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/Registration.fxml"));
Scene scene = new Scene(loader.load());
Registration controller = loader.getController();
controller.setUniversityObj(university);
stage = new Stage();
stage.setScene(scene);
stage.setTitle("Edit Person");
stage.initModality(Modality.WINDOW_MODAL);
stage.showAndWait();
return controller.getUniversityObj();
}
public Course cadastro(Course course) throws IOException {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("view/Registration.fxml"));
Scene scene = new Scene(loader.load());
Registration controller = loader.getController();
controller.setCourseObj(course);
stage = new Stage();
stage.setScene(scene);
stage.setTitle("Edit Person");
stage.initModality(Modality.WINDOW_MODAL);
stage.showAndWait();
return controller.getCourseObj();
}
public Stage getStage() {
return stage;
}
public void setStage(Stage stage) {
this.stage = stage;
}
}