Skip to content

Commit

Permalink
added ktfx sample
Browse files Browse the repository at this point in the history
  • Loading branch information
yostane committed Nov 7, 2024
1 parent a456639 commit a20467f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ javafx {

application {
// Define the main class for the application.
mainClass = "org.example.AppKt"
mainClass = "org.example.App"
}

tasks.named<Test>("test") {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<App>(*args)
}
}

0 comments on commit a20467f

Please sign in to comment.