-
Notifications
You must be signed in to change notification settings - Fork 0
/
StageController.java
50 lines (39 loc) · 1.13 KB
/
StageController.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
package javafxsanyi;
import java.util.HashMap;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author SchaferAkos
*/
public class StageController {
private static Stage root_stage;
private static HashMap<String, Scene> scene_map = new HashMap<>();
private static HashMap<String, Parent> view_map = new HashMap<>();
public static Stage getRoot_stage() {
return root_stage;
}
public static void setRoot_stage(Stage root) {
root_stage = root;
}
public static void addView(String name, Parent fxml){
view_map.put(name, fxml);
}
public static void addScene(String name, Scene scene){
scene_map.put(name, scene);
}
public static Parent getView(String key){
return view_map.get(key);
}
public static void CreateView(String str) {
System.out.print("Create VIEW");
root_stage.setScene(scene_map.get(str));
root_stage.show();
}
public static void CloseView(){
System.out.print("Close VIEW");
root_stage.hide();
}
}