diff --git a/material/conferences/2024-11-12-paris-jug/javafxdemo/app/build.gradle.kts b/material/conferences/2024-11-12-paris-jug/javafxdemo/app/build.gradle.kts index 1f5c1f6..3ba2295 100644 --- a/material/conferences/2024-11-12-paris-jug/javafxdemo/app/build.gradle.kts +++ b/material/conferences/2024-11-12-paris-jug/javafxdemo/app/build.gradle.kts @@ -54,7 +54,7 @@ javafx { application { // Define the main class for the application. - mainClass = "org.example.AppKt" + mainClass = "org.example.App" } tasks.named("test") { diff --git a/material/conferences/2024-11-12-paris-jug/javafxdemo/app/src/main/kotlin/org/example/App.kt b/material/conferences/2024-11-12-paris-jug/javafxdemo/app/src/main/kotlin/org/example/App.kt index 55fdc2f..076bc6a 100644 --- a/material/conferences/2024-11-12-paris-jug/javafxdemo/app/src/main/kotlin/org/example/App.kt +++ b/material/conferences/2024-11-12-paris-jug/javafxdemo/app/src/main/kotlin/org/example/App.kt @@ -1,8 +1,32 @@ package org.example -class App : Application() { +import javafx.application.Application +import javafx.geometry.HPos +import javafx.stage.Stage +import ktfx.coroutines.onAction +import ktfx.dialogs.infoAlert +import ktfx.launchApplication +import ktfx.layouts.* -} -fun main() { - println(App().greeting) +class App : Application() { + override fun start(stage: Stage) { + stage.scene { + gridPane { + hgap = 10.0 + vgap = 10.0 + label("First name").grid(0, 0) + textField().grid(0, 1) + label("Last name").grid(1, 0) + textField().grid(1, 1) + button("Say hello") { + onAction { print("Clicked") } + }.grid(2, 1) + } + stage.show() + } + } + companion object { + @JvmStatic + fun main(vararg args: String) = launchApplication(*args) + } }