-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (44 loc) · 1.6 KB
/
Main.java
File metadata and controls
49 lines (44 loc) · 1.6 KB
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
package com.xwintop.xJavaFxTool;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import lombok.extern.slf4j.Slf4j;
import java.net.URL;
import java.util.ResourceBundle;
@Slf4j
public class Main extends Application {
public static void main(String[] args) {
try {
launch(args);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fXMLLoader = Main.getFXMLLoader();
ResourceBundle resourceBundle = fXMLLoader.getResources();
Parent root = fXMLLoader.load();
primaryStage.setResizable(true);
primaryStage.setTitle(resourceBundle.getString("Title"));
// primaryStage.getIcons().add(new Image("/images/icon.jpg"));
primaryStage.setScene(new Scene(root));
primaryStage.show();
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
System.exit(0);
}
});
}
public static FXMLLoader getFXMLLoader() {
ResourceBundle resourceBundle = ResourceBundle.getBundle("locale.FileUnicodeTransformationTool");
URL url = Object.class.getResource("/com/xwintop/xJavaFxTool/fxmlView/codeTools/FileUnicodeTransformationTool.fxml");
FXMLLoader fXMLLoader = new FXMLLoader(url, resourceBundle);
return fXMLLoader;
}
}