Skip to content

Instantly share code, notes, and snippets.

@PragmaticCoding
Last active January 13, 2022 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PragmaticCoding/f6d3bd9dfc261b6d411d7945172d5833 to your computer and use it in GitHub Desktop.
Save PragmaticCoding/f6d3bd9dfc261b6d411d7945172d5833 to your computer and use it in GitHub Desktop.
JavaFX Property "Bean" Implemented in Kotlin
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