-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUILoader.java
93 lines (82 loc) · 2 KB
/
UILoader.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
package intranet.source.client.loader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.application.Application;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.layout.GridPane;
import java.net.Socket;
import intranet.source.client.controller.UIController;
public class UILoader extends Application
{
public static void main(String[] args) {
launch(args);
}
public void start(Stage stage)
{
try
{
GridPane root = FXMLLoader.load(getClass().getResource("/LoginInterface.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setResizable(false);
// scene.getStylesheets().add("/Mycss.css");
mainstage = stage;
object = this;
stage.show();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void openChatBox(String name1,Socket client)
{
try
{
this.client = client;
System.out.println("Method called");
mainstage.close();
System.out.println("loading interface");
FXMLLoader loader =new FXMLLoader(getClass().getResource("/UserInterface.fxml"));
UIController uicontroller = new UIController(name1,client);
loader.setController(uicontroller);
System.out.println("Loaded interface and uicontroller set");
BorderPane root = loader.load();
Scene scene = new Scene(root);
chatstage = new Stage();
chatstage.setScene(scene);
scene.getStylesheets().add("/Mycss.css");
chatstage.setTitle(name1);
chatstage.show();
chatstage.setResizable(false);
}
catch(Exception e)
{
System.out.println("In loading second ui");
e.printStackTrace();
}
}
public void stop()
{
try
{
this.client.close();
}
catch(Exception e)
{
}
}
public Stage getStage()
{
return chatstage;
}
public static UILoader getObject()
{
return object;
}
private Stage mainstage, chatstage;
private static UILoader object;
private Socket client;
}