This is the official Oracle JavaFx "Hello world" e...
# tornadofx
m
This is the official Oracle JavaFx "Hello world" example, translated in Kotlin by IntelliJ IDEA, and then adjusted to more idiomatic Kotlin by me:
Copy code
import 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)
        }
    }
}