melatonina
01/29/2021, 5:51 PMimport javafx.application.Application
import javafx.event.EventHandler
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.layout.StackPane
import javafx.stage.Stage
class HelloWorld : Application() {
override fun start(primaryStage: Stage) {
primaryStage.apply {
title = "Hello World!"
scene = Scene(
StackPane().apply {
children.setAll(
Button().apply {
text = "Say 'Hello World'"
onAction = EventHandler {
println("Hello World!")
}
}
)
},
300.0, 250.0
)
show()
}
}
companion object {
@JvmStatic
fun main(args: Array<String>) {
launch(HelloWorld::class.java, *args)
}
}
}