1+ package com .xwintop .xJavaFxTool ;
2+
3+ import com .xwintop .xcore .util .javafx .JavaFxSystemUtil ;
4+ import javafx .application .Application ;
5+ import javafx .event .EventHandler ;
6+ import javafx .fxml .FXMLLoader ;
7+ import javafx .scene .Parent ;
8+ import javafx .scene .Scene ;
9+ import javafx .stage .Stage ;
10+ import javafx .stage .WindowEvent ;
11+ import lombok .extern .slf4j .Slf4j ;
12+
13+ import java .net .URL ;
14+ import java .util .ResourceBundle ;
15+
16+ @ Slf4j
17+ public class KeyToolApplication extends Application {
18+ public static void main (String [] args ) {
19+ try {
20+ launch (args );
21+ } catch (Exception e ) {
22+ e .printStackTrace ();
23+ }
24+ }
25+
26+ @ Override
27+ public void start (Stage primaryStage ) throws Exception {
28+ FXMLLoader fXMLLoader = KeyToolApplication .getFXMLLoader ();
29+ // ResourceBundle resourceBundle = fXMLLoader.getResources();
30+ Parent root = fXMLLoader .load ();
31+ primaryStage .setResizable (true );
32+ // primaryStage.setTitle(resourceBundle.getString("Title"));
33+ // primaryStage.getIcons().add(new Image("/images/icon.jpg"));
34+ double [] screenSize = JavaFxSystemUtil .getScreenSizeByScale (0.74 , 0.8 );
35+ primaryStage .setScene (new Scene (root , screenSize [0 ], screenSize [1 ]));
36+ primaryStage .show ();
37+ primaryStage .setOnCloseRequest (new EventHandler <WindowEvent >() {
38+ @ Override
39+ public void handle (WindowEvent event ) {
40+ System .exit (0 );
41+ }
42+ });
43+ }
44+
45+ public static FXMLLoader getFXMLLoader () {
46+ ResourceBundle resourceBundle = ResourceBundle .getBundle ("locale.KeyTool" );
47+ URL url = KeyToolApplication .class .getClassLoader ().getResource ("com/xwintop/xJavaFxTool/fxmlView/debugTools/KeyTool.fxml" );
48+ FXMLLoader fXMLLoader = new FXMLLoader (url , resourceBundle );
49+ return fXMLLoader ;
50+ }
51+ }
0 commit comments