package com.example.jmacro.wjdr; import com.example.jmacro.wjdr.demo.DemoThread; import com.example.jmacro.wjdr.ui.FXMLUtil; import com.example.jmacro.wjdr.util.Logger; import com.example.jmacro.wjdr.util.ResourceUtil; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; /** * UI入口 * * @author wangbing * @version 0.0.1 * @since 1.8 */ public class JMainApplication extends Application { public static Stage primaryStage; public static JMainController mainController; @Override public void start(Stage stage) throws Exception { Logger.setDebug(true); stage.setTitle("无限工具"); stage.setMinWidth(400); stage.setMinHeight(300); FXMLLoader mainLoader = FXMLUtil.load("main.fxml"); mainController = mainLoader.getController(); stage.setScene(new Scene(mainLoader.getRoot())); stage.centerOnScreen(); stage.show(); stage.setOnCloseRequest(event -> { stage.close(); System.exit(0); }); // 设置图标 Image icon = new Image(ResourceUtil.getInput("/icon.png")); stage.getIcons().add(icon); // 展示UI stage.show(); JMainApplication.primaryStage = stage; // 服务初始化 JMainService.init(new DemoThread(new JMacro())); } public static void main(String[] args) { launch(args); } }