commit 7117bdfdcc2e52a01dac1bdd372868581a6928f1 Author: Konrad Neitzel Date: Mon Mar 17 20:54:16 2025 +0100 First project structure. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cadbec --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.idea +*.iml +target +debug.out +/nbactions.xml +dependency-reduced-pom.xml \ No newline at end of file diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..cb28b0e Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..6f40a26 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..fdddb29 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/injectfx-example/pom.xml b/injectfx-example/pom.xml new file mode 100644 index 0000000..6c63b8b --- /dev/null +++ b/injectfx-example/pom.xml @@ -0,0 +1,202 @@ + + + 4.0.0 + + + de.neitzel + injectfx + 1.0-SNAPSHOT + + + injectfx-example + + + ${project.artifactId} + ${project.artifactId} + ${project.artifactId} + de.kneitzel.Main + ${project.artifactId}-${project.version} + + + + + + de.neitzel + injectfx-lib + ${project.version} + + + + + ${jar.filename} + + + com.github.spotbugs + spotbugs-maven-plugin + + + + org.apache.maven.plugins + maven-pmd-plugin + + + + + + + + + image + + + image + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + ${maven.dependency.plugin} + + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory}/modules + runtime + false + false + true + + + + + + copy + install + + copy + + + ${project.build.directory}/modules + + + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${project.build.finalName}.jar + + + true + + + + + + + com.github.akman + jpackage-maven-plugin + ${jpackage.maven.plugin} + + ${appName} + IMAGE + + + + + javafx\..* + + + + + + javafx.controls + javafx.graphics + javafx.fxml + javafx.web + + ${main.class} + ${project.build.directory}/modules + ${jar.filename}.jar + + + + install + + jpackage + + + + + + + + + + + fatjar + + + fatjar + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven.shade.plugin} + + + package + + shade + + + + + true + full + + + + + ${main.class} + 1.0 + + + + + + *:* + + META-INF/MANIFEST.MF + **/module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + + diff --git a/injectfx-example/src/main/java/de/kneitzel/JavaFXApp.java b/injectfx-example/src/main/java/de/kneitzel/JavaFXApp.java new file mode 100644 index 0000000..b477580 --- /dev/null +++ b/injectfx-example/src/main/java/de/kneitzel/JavaFXApp.java @@ -0,0 +1,30 @@ +package de.kneitzel; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.io.IOException; + +public class JavaFXApp extends Application { + + @Override + public void start(Stage primaryStage) { + try { + primaryStage.setTitle("Hello World!"); + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainWindow.fxml")); + Parent root = fxmlLoader.load(); + primaryStage.setScene(new Scene(root)); + primaryStage.show(); + } catch (Exception ex) { + System.out.println("Exception: " + ex.getMessage()); + ex.printStackTrace(); + } + } + + public static void main(String[] args) { + launch(args); + } +} diff --git a/injectfx-example/src/main/java/de/kneitzel/Main.java b/injectfx-example/src/main/java/de/kneitzel/Main.java new file mode 100644 index 0000000..82917a6 --- /dev/null +++ b/injectfx-example/src/main/java/de/kneitzel/Main.java @@ -0,0 +1,15 @@ +package de.kneitzel; + +/** + * Another Main class as workaround when the JavaFX Application ist started without + * taking care os Classloader Requirements of JavaFX. (Important when starting from inside NetBeans!) + */ +public class Main { + /** + * Additional main methode to start Application. + * @param args Commandline Arguments. + */ + public static void main(String[] args) { + JavaFXApp.main(args); + } +} diff --git a/injectfx-example/src/main/java/de/kneitzel/MainWindow.java b/injectfx-example/src/main/java/de/kneitzel/MainWindow.java new file mode 100644 index 0000000..fd731f4 --- /dev/null +++ b/injectfx-example/src/main/java/de/kneitzel/MainWindow.java @@ -0,0 +1,33 @@ +package de.kneitzel; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.TextField; + +import java.net.URL; +import java.util.ResourceBundle; + +public class MainWindow implements Initializable { + + + private int counter = 0; + + @FXML + private TextField textField; + + @Override + public void initialize(URL location, ResourceBundle resources) { + displayCounter(); + } + + private void displayCounter() { + textField.setText("Click counter: " + counter); + } + + @FXML + private void onButtonClick(ActionEvent actionEvent) { + counter++; + displayCounter(); + } +} diff --git a/injectfx-example/src/main/resources/de/kneitzel/MainWindow.fxml b/injectfx-example/src/main/resources/de/kneitzel/MainWindow.fxml new file mode 100644 index 0000000..3b6f267 --- /dev/null +++ b/injectfx-example/src/main/resources/de/kneitzel/MainWindow.fxml @@ -0,0 +1,11 @@ + + + + + + + +