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