/
SplashController.java
59 lines (50 loc) · 1.85 KB
/
SplashController.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
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
/**
* Created by Aakash on 29-03-2017.
*/
public class SplashController implements Initializable {
@FXML
private StackPane rootPane;
@Override
public void initialize(URL url, ResourceBundle rb) {
new SplashScreen().start();
}
class SplashScreen extends Thread{
public void run()
{
try {
Thread.sleep(5000);
Platform.runLater(new Runnable() {
@Override
public void run() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("sample.fxml"));
loader.setControllerFactory(t -> new EditorController(new EditorModel()));
Stage stage=new Stage();
stage.getIcons().add(new Image("file:C:\\Users\\Vedant\\IdeaProjects\\code_refactoring\\src\\Image\\logo.PNG"));
stage.setTitle("Code Refactoring Tool");
stage.setMaximized(true);
try {
stage.setScene(new Scene(loader.load()));
} catch (IOException e) {
e.printStackTrace();
}
stage.show();
rootPane.getScene().getWindow().hide();
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}