From 34addf37f8263106f0a572975f90319c25bade93 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Mon, 2 Feb 2015 00:52:31 -0600 Subject: [PATCH] Start of JavaFX overhaul... --- nbactions.xml | 6 ++-- pom.xml | 46 ++++++++++++++++++++++-- src/main/java/jace/JaceApplication.java | 22 +++++++++--- src/main/java/jace/JaceUIController.java | 2 +- 4 files changed, 64 insertions(+), 12 deletions(-) diff --git a/nbactions.xml b/nbactions.xml index 08e022a..b842463 100644 --- a/nbactions.xml +++ b/nbactions.xml @@ -12,7 +12,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -classpath target/jace-2.0-SNAPSHOT.jar jace.Emulator + -classpath %classpath jace.JaceApplication java @@ -26,7 +26,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath target/jace-2.0-SNAPSHOT.jar jace.Emulator + -classpath %classpath jace.JaceApplication java true @@ -41,7 +41,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath target/jace-2.0-SNAPSHOT.jar jace.Emulator + -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath jace.JaceApplication java true diff --git a/pom.xml b/pom.xml index 6c8e776..41c1079 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,29 @@ + com.zenjava + javafx-maven-plugin + 2.0 + + outlawEditor + jace.JaceApplication + + example-user + example-password + true + ALL + + + + package + package + + jar + + + + + + + org.apache.maven.plugins maven-compiler-plugin @@ -105,4 +129,20 @@ + + + + javafx-packager + javafx-packager + 1.7 + ${java.home}/../lib/ant-javafx.jar + system + + diff --git a/src/main/java/jace/JaceApplication.java b/src/main/java/jace/JaceApplication.java index c7f86e6..2185e23 100644 --- a/src/main/java/jace/JaceApplication.java +++ b/src/main/java/jace/JaceApplication.java @@ -6,10 +6,12 @@ package jace; +import java.io.IOException; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; +import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; /** @@ -17,15 +19,25 @@ import javafx.stage.Stage; * @author blurry */ public class JaceApplication extends Application { + + Stage primaryStage; + JaceUIController controller; @Override public void start(Stage stage) throws Exception { - Parent root = FXMLLoader.load(getClass().getResource("fxml/JaceUI.fxml")); + primaryStage = stage; + FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/JaceUI.fxml")); + fxmlLoader.setResources(null); + try { + AnchorPane node = (AnchorPane) fxmlLoader.load(); + controller = fxmlLoader.getController(); + Scene s = new Scene(node); + primaryStage.setScene(s); + } catch (IOException exception) { + throw new RuntimeException(exception); + } - Scene scene = new Scene(root); - - stage.setScene(scene); - stage.show(); + primaryStage.show(); } /** diff --git a/src/main/java/jace/JaceUIController.java b/src/main/java/jace/JaceUIController.java index 485b179..1cc3407 100644 --- a/src/main/java/jace/JaceUIController.java +++ b/src/main/java/jace/JaceUIController.java @@ -6,7 +6,7 @@ package jace; -import java.awt.Canvas; +import javafx.scene.canvas.Canvas; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML;