commit d05def61791415b2803cfe5467d87328e8e593f1
Author: A Koens <[email protected]>
Date: Wed, 7 Sep 2022 20:46:55 +0200
Setup
Initial javaFX project creation with FXML implementation.
Diffstat:
8 files changed, 219 insertions(+), 0 deletions(-)
diff --git a/.gitattributes b/.gitattributes
@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,32 @@
+# Idea
+.idea/
+.idea_modules/
+
+# IntelliJ
+out/
+target/
+
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+replay_pid*
diff --git a/ISYGameClient.iml b/ISYGameClient.iml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17">
+ <output url="file://$MODULE_DIR$/target/classes" />
+ <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+ <excludeFolder url="file://$MODULE_DIR$/target" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:win:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:win:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-base:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-base:win:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-fxml:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-fxml:win:18.0.2" level="project" />
+ <orderEntry type="library" name="Maven: org.controlsfx:controlsfx:11.1.1" level="project" />
+ <orderEntry type="library" name="Maven: org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.9.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.9.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.9.0" level="project" />
+ <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.9.0" level="project" />
+ </component>
+</module>
+\ No newline at end of file
diff --git a/pom.xml b/pom.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.example</groupId>
+ <artifactId>ISYGameClient</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>ISYGameClient</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <junit.version>5.9.0</junit.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openjfx</groupId>
+ <artifactId>javafx-controls</artifactId>
+ <version>18.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openjfx</groupId>
+ <artifactId>javafx-fxml</artifactId>
+ <version>18.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.controlsfx</groupId>
+ <artifactId>controlsfx</artifactId>
+ <version>11.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.kordamp.bootstrapfx</groupId>
+ <artifactId>bootstrapfx-core</artifactId>
+ <version>0.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.1</version>
+ <configuration>
+ <source>17</source>
+ <target>17</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.openjfx</groupId>
+ <artifactId>javafx-maven-plugin</artifactId>
+ <version>0.0.8</version>
+ <executions>
+ <execution>
+ <!-- Default configuration for running with: mvn clean javafx:run -->
+ <id>default-cli</id>
+ <configuration>
+ <mainClass>com.example.isygameclient/com.example.isygameclient.HelloApplication</mainClass>
+ <launcher>app</launcher>
+ <jlinkZipName>app</jlinkZipName>
+ <jlinkImageName>app</jlinkImageName>
+ <noManPages>true</noManPages>
+ <stripDebug>true</stripDebug>
+ <noHeaderFiles>true</noHeaderFiles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+\ No newline at end of file
diff --git a/src/main/java/com/example/isygameclient/HelloApplication.java b/src/main/java/com/example/isygameclient/HelloApplication.java
@@ -0,0 +1,23 @@
+package com.example.isygameclient;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+import java.io.IOException;
+
+public class HelloApplication extends Application {
+ @Override
+ public void start(Stage stage) throws IOException {
+ FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("views/hello-view.fxml"));
+ Scene scene = new Scene(fxmlLoader.load(), 320, 240);
+ stage.setTitle("Hello!");
+ stage.setScene(scene);
+ stage.show();
+ }
+
+ public static void main(String[] args) {
+ launch();
+ }
+}
+\ No newline at end of file
diff --git a/src/main/java/com/example/isygameclient/controllers/HelloController.java b/src/main/java/com/example/isygameclient/controllers/HelloController.java
@@ -0,0 +1,14 @@
+package com.example.isygameclient.controllers;
+
+import javafx.fxml.FXML;
+import javafx.scene.control.Label;
+
+public class HelloController {
+ @FXML
+ private Label welcomeText;
+
+ @FXML
+ protected void onHelloButtonClick() {
+ welcomeText.setText("Welcome to JavaFX Application!");
+ }
+}
+\ No newline at end of file
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
@@ -0,0 +1,12 @@
+module com.example.isygameclient {
+ requires javafx.controls;
+ requires javafx.fxml;
+
+ requires org.controlsfx.controls;
+ requires org.kordamp.bootstrapfx.core;
+
+ opens com.example.isygameclient to javafx.fxml;
+ exports com.example.isygameclient;
+ exports com.example.isygameclient.controllers;
+ opens com.example.isygameclient.controllers to javafx.fxml;
+}
+\ No newline at end of file
diff --git a/src/main/resources/com/example/isygameclient/views/hello-view.fxml b/src/main/resources/com/example/isygameclient/views/hello-view.fxml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.geometry.Insets?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.layout.VBox?>
+
+<?import javafx.scene.control.Button?>
+<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
+ fx:controller="com.example.isygameclient.controllers.HelloController">
+ <padding>
+ <Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
+ </padding>
+
+ <Label fx:id="welcomeText"/>
+ <Button text="Hello!" onAction="#onHelloButtonClick"/>
+</VBox>