-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:worldline/learning-kotlin
- Loading branch information
Showing
10 changed files
with
261 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"catalogs": {}, | ||
"aliases": { | ||
"jfxapp": { | ||
"script-ref": "material/scripting/jbang/jfxdemo.kt", | ||
"description": "Single file JavaFX application that defined the UI with code (no fxml)" | ||
} | ||
}, | ||
"templates": { | ||
"jfxkt-legacy": { | ||
"file-refs": { | ||
"{basename}.kt": "material/scripting/jbang/jfxdemo.kt" | ||
}, | ||
"description": "Single file JavaFX application", | ||
"properties": {} | ||
}, | ||
"jfxkt": { | ||
"file-refs": { | ||
"{basename}.kt": "material/scripting/jbang/jfxdemo.qute" | ||
}, | ||
"description": "Single file JavaFX application that defined the UI with code (no fxml)", | ||
"properties": {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
///usr/bin/env jbang "$0" "$@" ; exit $? | ||
|
||
//DEPS org.openjfx:javafx-controls:23 | ||
//DEPS org.openjfx:javafx-graphics:23:${os.detected.jfxname} | ||
//DEPS org.openjfx:javafx-fxml:23 | ||
|
||
import javafx.application.Application | ||
import javafx.geometry.Pos | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.scene.layout.VBox | ||
import javafx.stage.Stage | ||
|
||
class HelloJFXApp : Application() { | ||
private var scene: Scene? = null | ||
|
||
override fun start(stage: Stage) { | ||
val javaInfoString = String.format( | ||
"Java: %s, %s , %s", | ||
System.getProperty("java.version"), | ||
System.getProperty("java.vendor"), | ||
System.getProperty("java.vm.version") | ||
) | ||
val jfxInfoString = String.format("JavaFX: %s", System.getProperty("javafx.version")) | ||
|
||
val holder = VBox() | ||
holder.isFillWidth = true | ||
holder.alignment = Pos.TOP_CENTER | ||
holder.spacing = 5.0 | ||
holder.children.addAll( | ||
Label(javaInfoString), | ||
Label(jfxInfoString), | ||
) | ||
|
||
scene = Scene(holder, 400.0, 300.0) | ||
stage.title = "JavaFX Demo" | ||
stage.scene = scene | ||
stage.show() | ||
} | ||
} | ||
|
||
fun main() { | ||
Application.launch(HelloJFXApp::class.java) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
///usr/bin/env jbang "$0" "$@" ; exit $? | ||
|
||
//DEPS org.openjfx:javafx-controls:23 | ||
//DEPS org.openjfx:javafx-graphics:23:${os.detected.jfxname} | ||
//DEPS org.openjfx:javafx-fxml:23 | ||
|
||
import javafx.application.Application | ||
import javafx.geometry.Pos | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.scene.layout.VBox | ||
import javafx.stage.Stage | ||
|
||
class {baseName} : Application() { | ||
private var scene: Scene? = null | ||
|
||
override fun start(stage: Stage) { | ||
val javaInfoString = String.format( | ||
"Java: %s, %s , %s", | ||
System.getProperty("java.version"), | ||
System.getProperty("java.vendor"), | ||
System.getProperty("java.vm.version") | ||
) | ||
val jfxInfoString = String.format("JavaFX: %s", System.getProperty("javafx.version")) | ||
|
||
val holder = VBox() | ||
holder.isFillWidth = true | ||
holder.alignment = Pos.TOP_CENTER | ||
holder.spacing = 5.0 | ||
holder.children.addAll( | ||
Label(javaInfoString), | ||
Label(jfxInfoString), | ||
) | ||
|
||
scene = Scene(holder, 400.0, 300.0) | ||
stage.title = "JavaFX Demo" | ||
stage.scene = scene | ||
stage.show() | ||
} | ||
} | ||
|
||
fun main() { | ||
Application.launch(HelloJFXApp::class.java) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
///usr/bin/env jbang "$0" "$@" ; exit $? | ||
|
||
//DEPS org.openjfx:javafx-controls:23 | ||
//DEPS org.openjfx:javafx-graphics:23:${os.detected.jfxname} | ||
//DEPS org.openjfx:javafx-fxml:23 | ||
|
||
import javafx.application.Application | ||
import javafx.geometry.Pos | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.scene.layout.VBox | ||
import javafx.stage.Stage | ||
|
||
class HelloJFXApp : Application() { | ||
private var scene: Scene? = null | ||
|
||
override fun start(stage: Stage) { | ||
val javaInfoString = String.format( | ||
"Java: %s, %s , %s", | ||
System.getProperty("java.version"), | ||
System.getProperty("java.vendor"), | ||
System.getProperty("java.vm.version") | ||
) | ||
val jfxInfoString = String.format("JavaFX: %s", System.getProperty("javafx.version")) | ||
|
||
val holder = VBox() | ||
holder.isFillWidth = true | ||
holder.alignment = Pos.TOP_CENTER | ||
holder.spacing = 5.0 | ||
holder.children.addAll( | ||
Label(javaInfoString), | ||
Label(jfxInfoString), | ||
) | ||
|
||
scene = Scene(holder, 400.0, 300.0) | ||
stage.title = "JavaFX Demo" | ||
stage.scene = scene | ||
stage.show() | ||
} | ||
} | ||
|
||
fun main() { | ||
Application.launch(HelloJFXApp::class.java) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
///usr/bin/env jbang "$0" "$@" ; exit $? | ||
|
||
//DEPS org.openjfx:javafx-controls:23 | ||
//DEPS org.openjfx:javafx-graphics:23:$NOT_FOUND | ||
//DEPS org.openjfx:javafx-fxml:23 | ||
|
||
import javafx.application.Application | ||
import javafx.geometry.Pos | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.scene.layout.VBox | ||
import javafx.stage.Stage | ||
|
||
class testjfx2 : Application() { | ||
private var scene: Scene? = null | ||
|
||
override fun start(stage: Stage) { | ||
val javaInfoString = String.format( | ||
"Java: %s, %s , %s", | ||
System.getProperty("java.version"), | ||
System.getProperty("java.vendor"), | ||
System.getProperty("java.vm.version") | ||
) | ||
val jfxInfoString = String.format("JavaFX: %s", System.getProperty("javafx.version")) | ||
|
||
val holder = VBox() | ||
holder.isFillWidth = true | ||
holder.alignment = Pos.TOP_CENTER | ||
holder.spacing = 5.0 | ||
holder.children.addAll( | ||
Label(javaInfoString), | ||
Label(jfxInfoString), | ||
) | ||
|
||
scene = Scene(holder, 400.0, 300.0) | ||
stage.title = "JavaFX Demo" | ||
stage.scene = scene | ||
stage.show() | ||
} | ||
} | ||
|
||
fun main() { | ||
Application.launch(HelloJFXApp::class.java) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@file:CompilerOptions("-jvm-target", "1.8", "-Xabi-stability=unstable") | ||
|
||
interface Test { | ||
fun print() | ||
fun printSuper() = println("Hi from super") | ||
} | ||
|
||
class TestImpl : Test { | ||
override fun print() = println("Hi from sub") | ||
} | ||
|
||
fun printRandom() = println("Hi from random") | ||
|
||
TestImpl().run { | ||
print() | ||
printSuper() | ||
printRandom() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@file:DependsOn("org.openjfx:javafx-controls:23") | ||
@file:DependsOn("org.openjfx:javafx-graphics:23") | ||
|
||
import javafx.application.Application | ||
import javafx.geometry.Pos | ||
import javafx.scene.Scene | ||
import javafx.scene.control.Label | ||
import javafx.scene.layout.VBox | ||
import javafx.stage.Stage | ||
|
||
|
||
class HelloJFXApp : Application() { | ||
private var scene: Scene? = null | ||
|
||
override fun start(stage: Stage) { | ||
val javaInfoString = String.format( | ||
"Java: %s, %s , %s", | ||
System.getProperty("java.version"), | ||
System.getProperty("java.vendor"), | ||
System.getProperty("java.vm.version") | ||
) | ||
val jfxInfoString = String.format("JavaFX: %s", System.getProperty("javafx.version")) | ||
|
||
val holder = VBox() | ||
holder.isFillWidth = true | ||
holder.alignment = Pos.TOP_CENTER | ||
holder.spacing = 5.0 | ||
holder.children.addAll( | ||
Label(javaInfoString), | ||
Label(jfxInfoString), | ||
) | ||
|
||
scene = Scene(holder, 400.0, 300.0) | ||
stage.title = "JavaFX Demo" | ||
stage.scene = scene | ||
stage.show() | ||
} | ||
} | ||
|
||
Application.launch(HelloJFXApp::class.java) |
Empty file.