From c15472b54fd65579c9dc2ab2b544431ea172d13f Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Sat, 14 Jan 2023 23:36:07 -0500 Subject: [PATCH] Project start --- .gitignore | 6 ++ pom.xml | 56 +++++++++++ src/main/java/net/metaunix/App.java | 42 ++++++++ src/main/java/net/metaunix/SysInfo.java | 13 +++ .../metaunix/controllers/HomeController.java | 20 ++++ src/main/resources/views/home.fxml | 96 +++++++++++++++++++ 6 files changed, 233 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/net/metaunix/App.java create mode 100644 src/main/java/net/metaunix/SysInfo.java create mode 100644 src/main/java/net/metaunix/controllers/HomeController.java create mode 100644 src/main/resources/views/home.fxml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7456535 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# compiled assets +target/ + +# VS Code settings +.vscode/ + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..84eb3d0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,56 @@ + + 4.0.0 + net.metaunix + arrow + 0.1.0 + + UTF-8 + 17 + 17 + + + + org.openjfx + javafx-controls + 17 + + + org.openjfx + javafx-fxml + 17 + + + com.github.oshi + oshi-core + 6.4.0 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.openjfx + javafx-maven-plugin + 0.0.6 + + + + + default-cli + + net.metaunix.App + + + + + + + diff --git a/src/main/java/net/metaunix/App.java b/src/main/java/net/metaunix/App.java new file mode 100644 index 0000000..fa0c9b3 --- /dev/null +++ b/src/main/java/net/metaunix/App.java @@ -0,0 +1,42 @@ +package net.metaunix; + +import java.io.IOException; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.stage.Stage; +import oshi.SystemInfo; +import oshi.software.os.OperatingSystem; + + +/** + * JavaFX App + */ +public class App extends Application { + + @Override + public void start(Stage stage) throws IOException { + var javaVersion = SysInfo.javaVersion(); + var javafxVersion = SysInfo.javafxVersion(); + + var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."); + + SystemInfo si = new SystemInfo(); + OperatingSystem os = si.getOperatingSystem(); + System.out.println(String.valueOf(os)); + + Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("views/home.fxml")); + var scene = new Scene(root, 640, 480); + stage.setTitle("Arrow System Monitor"); + stage.setScene(scene); + stage.show(); + } + + public static void main(String[] args) { + launch(); + } + +} diff --git a/src/main/java/net/metaunix/SysInfo.java b/src/main/java/net/metaunix/SysInfo.java new file mode 100644 index 0000000..d785d64 --- /dev/null +++ b/src/main/java/net/metaunix/SysInfo.java @@ -0,0 +1,13 @@ +package net.metaunix; + +public class SysInfo { + + public static String javaVersion() { + return System.getProperty("java.version"); + } + + public static String javafxVersion() { + return System.getProperty("javafx.version"); + } + +} \ No newline at end of file diff --git a/src/main/java/net/metaunix/controllers/HomeController.java b/src/main/java/net/metaunix/controllers/HomeController.java new file mode 100644 index 0000000..6e3b78e --- /dev/null +++ b/src/main/java/net/metaunix/controllers/HomeController.java @@ -0,0 +1,20 @@ +package net.metaunix.controllers; + +import javafx.fxml.FXML; +import javafx.scene.control.Label; +import oshi.SystemInfo; +import oshi.software.os.OperatingSystem; + +public class HomeController { + + @FXML + private Label osInfo; + + @FXML + public void initialize() { + SystemInfo si = new SystemInfo(); + OperatingSystem os = si.getOperatingSystem(); + osInfo.setText(String.valueOf(os)); + } + +} diff --git a/src/main/resources/views/home.fxml b/src/main/resources/views/home.fxml new file mode 100644 index 0000000..eb18fc3 --- /dev/null +++ b/src/main/resources/views/home.fxml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +