class HelloApplication : Application() {
override fun start(stage: Stage) {
println("start...${Thread.currentThread().name}")
val fxmlLoader = FXMLLoader(HelloApplication::class.java.getResource("hello-view.fxml"))
val scene = Scene(fxmlLoader.load(), 320.0, 240.0)
stage.title = "Hello!"
stage.scene = scene
stage.show()
}
override fun init() {
println("init...${Thread.currentThread().name}")
}
}
fun main() {
Application.launch(HelloApplication::class.java)
}
- init跟start不在同一个线程里,init先于start执行
网友评论