Last active
January 13, 2022 07:10
-
-
Save PragmaticCoding/f6d3bd9dfc261b6d411d7945172d5833 to your computer and use it in GitHub Desktop.
JavaFX Property "Bean" Implemented in Kotlin
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
class KotlinClass() { | |
private val _nickName: ObjectProperty<String> = SimpleObjectProperty("") | |
var nickName: String | |
get() = _nickName.get() | |
set(value) = _nickName.set(value) | |
fun nickNameProperty() = _nickName | |
} | |
fun main(args: Array<String>) { | |
val testClass = KotlinClass() | |
testClass.nickName = "Shorty" | |
println("Nickname: ${testClass.nickName}") | |
println("Property: " + testClass.nickNameProperty()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment