From 7bdc26ff2a903b164f8155e27a47040c7c8619bd Mon Sep 17 00:00:00 2001 From: Conor Egan <68134729+c-eg@users.noreply.github.com> Date: Wed, 5 Apr 2023 18:36:36 +0100 Subject: [PATCH] slightly better naming --- pom.xml | 2 +- .../showrenamer/JavaFxApplication.java | 77 ------------------- .../showrenamer/ShowRenamerApplication.java | 61 ++++++++++++--- .../showrenamer/ShowRenamerLauncher.java | 34 ++++++++ 4 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 src/main/java/uk/co/conoregan/showrenamer/JavaFxApplication.java create mode 100644 src/main/java/uk/co/conoregan/showrenamer/ShowRenamerLauncher.java diff --git a/pom.xml b/pom.xml index 14b2428..5419a22 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ javafx-maven-plugin 0.0.8 - uk.co.conoregan.showrenamer.JavaFxApplication + uk.co.conoregan.showrenamer.ShowRenamerApplication diff --git a/src/main/java/uk/co/conoregan/showrenamer/JavaFxApplication.java b/src/main/java/uk/co/conoregan/showrenamer/JavaFxApplication.java deleted file mode 100644 index 210385d..0000000 --- a/src/main/java/uk/co/conoregan/showrenamer/JavaFxApplication.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * This file is part of ShowRenamer. - * - * ShowRenamer is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * ShowRenamer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ShowRenamer. If not, see . - */ - -package uk.co.conoregan.showrenamer; - -import javafx.application.Application; -import javafx.fxml.FXMLLoader; -import javafx.scene.Parent; -import javafx.scene.Scene; -import javafx.stage.Stage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URL; - -/** - * The starting point of the ShowRenamer application. - */ -public class JavaFxApplication extends Application { - /** - * The logger. - */ - private static final Logger LOGGER = LoggerFactory.getLogger(JavaFxApplication.class); - - /** - * The screen width. - */ - private static final int WIDTH = 1280; - - /** - * The screen height. - */ - private static final int HEIGHT = 720; - - public static void main(String[] args) { - launch(args); - } - - @Override - public void start(Stage primaryStage) throws Exception { - final String viewPath = "view/rename.fxml"; - final URL startView = getClass().getClassLoader().getResource(viewPath); - - if (startView == null) { - LOGGER.error(String.format("The resource: %s was not found.", viewPath)); - System.exit(0); - } - - final Parent root = FXMLLoader.load(startView); - final Scene scene = new Scene(root, WIDTH, HEIGHT); - - primaryStage.setMinWidth(WIDTH); - primaryStage.setMinHeight(HEIGHT); - primaryStage.setTitle("Show Renamer"); - primaryStage.setScene(scene); - // primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("images/icon.png"))); - - primaryStage.show(); - LOGGER.info("Show Renamer successfully started."); - } -} - - diff --git a/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerApplication.java b/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerApplication.java index c4aeb04..4fea956 100644 --- a/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerApplication.java +++ b/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerApplication.java @@ -17,18 +17,61 @@ package uk.co.conoregan.showrenamer; +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URL; + /** - * This is a class to call the main function from a class that doesn't extend Application. It is needed in order to run the app without - * module-info. I don't want to add module info until all dependencies have it too, in order to generate a runtime image with jlink. - * For now, I will create a 'fat' jar and use jpackage to generate an installer. + * The starting point of the ShowRenamer application. */ -public class ShowRenamerApplication { +public class ShowRenamerApplication extends Application { + /** + * The logger. + */ + private static final Logger LOGGER = LoggerFactory.getLogger(ShowRenamerApplication.class); + /** - * Start function. - * - * @param args the args. + * The screen width. */ + private static final int WIDTH = 1280; + + /** + * The screen height. + */ + private static final int HEIGHT = 720; + public static void main(String[] args) { - JavaFxApplication.main(args); + launch(args); } -} \ No newline at end of file + + @Override + public void start(Stage primaryStage) throws Exception { + final String viewPath = "view/rename.fxml"; + final URL startView = getClass().getClassLoader().getResource(viewPath); + + if (startView == null) { + LOGGER.error(String.format("The resource: %s was not found.", viewPath)); + System.exit(0); + } + + final Parent root = FXMLLoader.load(startView); + final Scene scene = new Scene(root, WIDTH, HEIGHT); + + primaryStage.setMinWidth(WIDTH); + primaryStage.setMinHeight(HEIGHT); + primaryStage.setTitle("Show Renamer"); + primaryStage.setScene(scene); + // primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("images/icon.png"))); + + primaryStage.show(); + LOGGER.info("Show Renamer successfully started."); + } +} + + diff --git a/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerLauncher.java b/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerLauncher.java new file mode 100644 index 0000000..138f88a --- /dev/null +++ b/src/main/java/uk/co/conoregan/showrenamer/ShowRenamerLauncher.java @@ -0,0 +1,34 @@ +/* + * This file is part of ShowRenamer. + * + * ShowRenamer is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ShowRenamer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ShowRenamer. If not, see . + */ + +package uk.co.conoregan.showrenamer; + +/** + * This is a class to call the main function from a class that doesn't extend Application. It is needed in order to run the app without + * module-info. I don't want to add module info until all dependencies have it too, in order to generate a runtime image with jlink. + * For now, I will create a 'fat' jar and use jpackage to generate an installer. + */ +public class ShowRenamerLauncher { + /** + * Start function. + * + * @param args the args. + */ + public static void main(String[] args) { + ShowRenamerApplication.main(args); + } +} \ No newline at end of file