Blame view

src/main/kotlin/application/App.kt 1.08 KB
2f45c53df   lsagona   skeleton for user...
1
2
3
  package application
  
  import javafx.application.Application
f15a58907   lsagona   add better chart
4
5
  import javafx.application.Platform
  import javafx.event.EventHandler
2f45c53df   lsagona   skeleton for user...
6
7
8
9
  import javafx.fxml.FXMLLoader
  import javafx.scene.Parent
  import javafx.scene.Scene
  import javafx.stage.Stage
f15a58907   lsagona   add better chart
10
  import javafx.stage.WindowEvent
52321443a   lsagona   different color f...
11
12
  import jfxtras.styles.jmetro.JMetro
  import jfxtras.styles.jmetro.Style
f15a58907   lsagona   add better chart
13
  import kotlin.system.exitProcess
2f45c53df   lsagona   skeleton for user...
14
15
  
  class App : Application() {
52321443a   lsagona   different color f...
16
      var style : Style = Style.LIGHT
2f45c53df   lsagona   skeleton for user...
17
18
  
      override fun start(primaryStage: Stage?) {
b350f9dfe   lsagona   import vessels an...
19
20
          val fxmlLoader = FXMLLoader(App::class.java.getResource("/gui/windows.fxml"))
          val parent: Parent = fxmlLoader.load()
2f45c53df   lsagona   skeleton for user...
21
          val scene = Scene(parent)
52321443a   lsagona   different color f...
22
          JMetro(scene, style)
2f45c53df   lsagona   skeleton for user...
23
24
          primaryStage!!.scene = scene
          primaryStage.title = "Maritime Visualisation"
f15a58907   lsagona   add better chart
25
          primaryStage.onCloseRequest = EventHandler { closeApplication() }
2f45c53df   lsagona   skeleton for user...
26
27
          primaryStage.show()
      }
f15a58907   lsagona   add better chart
28
29
30
31
      private fun closeApplication() {
          Platform.exit()
          exitProcess(0)
      }
2f45c53df   lsagona   skeleton for user...
32
33
34
35
36
37
38
39
      companion object {
          @JvmStatic
          fun main(args: Array<String>) {
              launch(App::class.java)
          }
      }
  
  }