diff --git a/src/main/java/com/sothr/imagetools/App.java b/src/main/java/com/sothr/imagetools/App.java
index c9c62e3..5c56893 100644
--- a/src/main/java/com/sothr/imagetools/App.java
+++ b/src/main/java/com/sothr/imagetools/App.java
@@ -66,8 +66,12 @@ public class App extends Application
try {
Parent root = FXMLLoader.load(cl.getResource(MAINGUI_FXML));
primaryStage.setScene(new Scene(root));
+ //config main scene
primaryStage.setTitle("Image Tools");
+ primaryStage.setMinHeight(600.0);
+ primaryStage.setMinWidth(800.0);
primaryStage.setResizable(true);
+ //show main scene
primaryStage.show();
} catch (IOException ioe) {
String message = String.format("Unable to load FXML file: %s", MAINGUI_FXML);
diff --git a/src/main/resources/documents/about b/src/main/resources/documents/about
new file mode 100644
index 0000000..2f9539b
--- /dev/null
+++ b/src/main/resources/documents/about
@@ -0,0 +1,3 @@
+This is a simple about script. It demonstrates loading the about text from a file.
+
+It supports simple text, and nothing fancy.
\ No newline at end of file
diff --git a/src/main/resources/fxml/mainapp/MainApp.fxml b/src/main/resources/fxml/mainapp/MainApp.fxml
index 927c8f8..50d33f3 100644
--- a/src/main/resources/fxml/mainapp/MainApp.fxml
+++ b/src/main/resources/fxml/mainapp/MainApp.fxml
@@ -1,11 +1,27 @@
-
+
+
-
-
-
- printBtn.text = 'Click Me ' + controller.print() + '!';
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
diff --git a/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala b/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala
index 947ac8c..cb3b3a9 100644
--- a/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala
+++ b/src/main/scala/com/sothr/imagetools/ui/controller/AppController.scala
@@ -1,19 +1,65 @@
package com.sothr.imagetools.ui.controller
-import javafx.fxml.Initializable
+import javafx.fxml.FXML
+import javafx.event.ActionEvent
+import org.slf4j.LoggerFactory
+import org.slf4j.Logger
+import javafx.stage.{StageStyle, Stage}
+import javafx.scene.Scene
+import javafx.scene.Group
+import javafx.scene.text.Text
+import java.io.{IOException, File}
import java.net.URL
-import java.util.ResourceBundle
+import java.util.Scanner
/**
* Created by drew on 12/31/13.
*/
-class AppController extends Initializable {
+class AppController {
- def print():String = {
- return "This method works";
+ val logger:Logger = LoggerFactory.getLogger(this.getClass)
+
+ //Define controls
+ @FXML var rootMenuBar : javafx.scene.control.MenuBar = null
+
+ //region MenuItem Actions
+
+ @FXML
+ def aboutAction(event:ActionEvent) = {
+ logger.debug("Displaying about screen")
+ var aboutMessage = "Simple About Message"
+ try {
+ val cl = this.getClass.getClassLoader
+ val url = cl.getResource("documents/about")
+ val uri = url.toURI
+ aboutMessage = new Scanner(new File(uri)).useDelimiter("\\A").next()
+ } catch {
+ case ioe:IOException =>
+ logger.error("Unable to read about file")
+ }
+
+ val dialog:Stage = new Stage()
+ dialog.initStyle(StageStyle.UTILITY)
+ val parent:Group = new Group();
+ parent.getChildren.add(new Text(25, 25, aboutMessage))
+ val scene:Scene = new Scene(parent)
+ dialog.setScene(scene)
+ dialog.setResizable(false)
+ dialog.setMinHeight(400.0)
+ dialog.setMinWidth(400.0)
+ dialog.show()
+ }
+
+ @FXML
+ def closeAction(event:ActionEvent ) = {
+ logger.debug("Closing application from the menu bar")
+ val stage:Stage = this.rootMenuBar.getScene.getWindow.asInstanceOf[Stage]
+ stage.close()
}
- def initialize(p1: URL, p2: ResourceBundle): Unit = {
+ //endregion
+ def print():String = {
+ return "This method works"
}
}