55import com .xwintop .xJavaFxTool .utils .Config ;
66import com .xwintop .xJavaFxTool .utils .StageUtils ;
77import com .xwintop .xJavaFxTool .utils .XJavaFxSystemUtil ;
8+ import com .xwintop .xcore .FxApp ;
89import com .xwintop .xcore .util .javafx .AlertUtil ;
910import com .xwintop .xcore .util .javafx .JavaFxViewUtil ;
11+ import java .util .ResourceBundle ;
1012import javafx .application .Application ;
1113import javafx .application .Platform ;
1214import javafx .event .Event ;
1719import javafx .stage .Stage ;
1820import lombok .extern .slf4j .Slf4j ;
1921
20- import java .util .ResourceBundle ;
21-
2222/**
2323 * @ClassName: Main
2424 * @Description: 启动类
2828@ Slf4j
2929public class Main extends Application {
3030
31- public static final String PREFERENCE_ROOT = "com.xwintop.xJavaFxTool " ;
31+ public static final String LOGO_PATH = "/images/icon.jpg " ;
3232
3333 private static Stage stage ;
3434
@@ -43,6 +43,11 @@ public static void main(String[] args) {
4343
4444 @ Override
4545 public void start (Stage primaryStage ) throws Exception {
46+
47+ // 初始化 JavaFX 全局设置
48+ FxApp .init (primaryStage , LOGO_PATH );
49+ FxApp .styleSheets .add (Main .class .getResource ("/css/jfoenix-main.css" ).toExternalForm ());
50+
4651 XJavaFxSystemUtil .initSystemLocal ();//初始化本地语言
4752 XJavaFxSystemUtil .addJarByLibs ();//添加外部jar包
4853
@@ -51,18 +56,18 @@ public void start(Stage primaryStage) throws Exception {
5156 Parent root = fXMLLoader .load ();
5257
5358 JFXDecorator decorator = JavaFxViewUtil .getJFXDecorator (
54- primaryStage ,
55- resourceBundle .getString ("Title" ) + Config .xJavaFxToolVersions ,
56- "/images/icon.jpg" ,
57- root
59+ primaryStage ,
60+ resourceBundle .getString ("Title" ) + Config .xJavaFxToolVersions ,
61+ LOGO_PATH ,
62+ root
5863 );
5964 decorator .setOnCloseButtonAction (() -> confirmExit (null ));
6065
6166 Scene scene = JavaFxViewUtil .getJFXDecoratorScene (decorator );
6267
6368 primaryStage .setResizable (true );
6469 primaryStage .setTitle (resourceBundle .getString ("Title" ));//标题
65- primaryStage .getIcons ().add (new Image ("/images/icon.jpg" ));//图标
70+ primaryStage .getIcons ().add (new Image (LOGO_PATH ));//图标
6671 primaryStage .setScene (scene );
6772 primaryStage .setOnCloseRequest (this ::confirmExit );
6873
@@ -75,7 +80,7 @@ public void start(Stage primaryStage) throws Exception {
7580
7681 private void confirmExit (Event event ) {
7782 if (XJavaFxSystemUtil .getSystemConfigure ().getBoolean ("exitShowAlertCheckBox" , true )) {
78- if (AlertUtil .showConfirmAlert ( "确定要退出吗?" )) {
83+ if (AlertUtil .confirmOkCancel ( "退出应用" , "确定要退出吗?" )) {
7984 StageUtils .savePrimaryStageBound (stage );
8085 Platform .exit ();
8186 System .exit (0 );
0 commit comments