更新时间:2023-11-18 15:32:16
为GUI创建一个单独的类:
Create a separate class for the GUI:
public class Main {
public static void main(String[] args) {
if (args != null && args.length > 0 && args[0].equals("cli")) {
String pathToProperties = args[1];
Cli cli = new Cli(pathToProperties);
cli.loadPropertiesAndGenerateApk();
} else {
Application.launch(GUIApp.class, args);
}
}
}
和
public class GUIApp extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader loader = new FXMLLoader(getClass().getResource("view/sample.fxml"));
Parent root = (Parent) loader.load();
primaryStage.setTitle("Allowed Site Configurator");
primaryStage.setScene(new Scene(root, 800, 800));
primaryStage.show();
}
}
并配置构建以便 Main
是主类。
and configure the build so that Main
is the main class.