You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

  1. package com.sothr.imagetools.ui.controller
  2. import javafx.fxml.FXML
  3. import javafx.event.ActionEvent
  4. import org.slf4j.LoggerFactory
  5. import org.slf4j.Logger
  6. import javafx.stage.{StageStyle, Stage}
  7. import javafx.scene.Scene
  8. import javafx.scene.Group
  9. import javafx.scene.text.Text
  10. import java.io.{IOException, File}
  11. import java.util.Scanner
  12. import com.sothr.imagetools.util.FileLoader
  13. import java.net.URL
  14. /**
  15. * Created by drew on 12/31/13.
  16. */
  17. class AppController {
  18. val logger:Logger = LoggerFactory.getLogger(this.getClass)
  19. //Define controls
  20. @FXML var rootMenuBar : javafx.scene.control.MenuBar = null
  21. //region MenuItem Actions
  22. @FXML
  23. def aboutAction(event:ActionEvent) = {
  24. logger.debug("Displaying about screen")
  25. var aboutMessage = "Simple About Message"
  26. try {
  27. aboutMessage = new Scanner(FileLoader.get().getResourceStream("documents/about")).useDelimiter("\\A").next()
  28. } catch {
  29. case ioe:IOException =>
  30. logger.error("Unable to read about file")
  31. }
  32. val dialog:Stage = new Stage()
  33. dialog.initStyle(StageStyle.UTILITY)
  34. val parent:Group = new Group();
  35. parent.getChildren.add(new Text(25, 25, aboutMessage))
  36. val scene:Scene = new Scene(parent)
  37. dialog.setScene(scene)
  38. dialog.setResizable(false)
  39. dialog.setMinHeight(400.0)
  40. dialog.setMinWidth(400.0)
  41. dialog.show()
  42. }
  43. @FXML
  44. def closeAction(event:ActionEvent ) = {
  45. logger.debug("Closing application from the menu bar")
  46. val stage:Stage = this.rootMenuBar.getScene.getWindow.asInstanceOf[Stage]
  47. stage.close()
  48. }
  49. //endregion
  50. def print():String = {
  51. return "This method works"
  52. }
  53. }