diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index e0c98e0..308d634 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,5 @@ module net.cuprak.sample { requires javafx.controls; + requires javafx.fxml; exports net.cuprak.sample; } diff --git a/src/main/java/net/cuprak/sample/Controller.java b/src/main/java/net/cuprak/sample/Controller.java new file mode 100644 index 0000000..6af6b30 --- /dev/null +++ b/src/main/java/net/cuprak/sample/Controller.java @@ -0,0 +1,13 @@ +package net.cuprak.sample; + +import javafx.fxml.Initializable; +import java.net.URL; +import java.util.ResourceBundle; + +public class Controller implements Initializable { + + @Override + public void initialize(URL location, ResourceBundle resources) { + // Initialize your controller + } +} diff --git a/src/main/java/net/cuprak/sample/JavaFXSkeletonApp.java b/src/main/java/net/cuprak/sample/JavaFXSkeletonApp.java index a8911bf..72c415a 100644 --- a/src/main/java/net/cuprak/sample/JavaFXSkeletonApp.java +++ b/src/main/java/net/cuprak/sample/JavaFXSkeletonApp.java @@ -1,8 +1,17 @@ package net.cuprak.sample; import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; import javafx.stage.Stage; +import java.io.IOException; +import java.util.ResourceBundle; + +/** + * Skeleton Application + */ public class JavaFXSkeletonApp extends Application { public static void main(String[] args) { @@ -10,10 +19,14 @@ public static void main(String[] args) { } @Override - public void start(Stage stage) { - stage.setTitle("Demo Application"); - int width = 640; - int height = 480; + public void start(Stage stage) throws IOException { + ResourceBundle bundle = ResourceBundle.getBundle("net.cuprak.sample.resources"); + FXMLLoader loader = new FXMLLoader(getClass().getResource("/net/cuprak/sample/App.fxml"),bundle); + Parent root = loader.load(); + Controller controller = loader.getController(); + Scene scene = new Scene(root); + stage.setScene(scene); + stage.setTitle(bundle.getString("appTitle")); stage.show(); } diff --git a/src/main/resources/net/cuprak/sample/App.fxml b/src/main/resources/net/cuprak/sample/App.fxml new file mode 100644 index 0000000..d6e5f66 --- /dev/null +++ b/src/main/resources/net/cuprak/sample/App.fxml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/src/main/resources/net/cuprak/sample/resources.properties b/src/main/resources/net/cuprak/sample/resources.properties new file mode 100644 index 0000000..62e700c --- /dev/null +++ b/src/main/resources/net/cuprak/sample/resources.properties @@ -0,0 +1,2 @@ +helloWorld=Hello World! +appTitle=JavaFX Skeleton \ No newline at end of file