Tornadofx: Code from guide not compiling

Created on 8 Nov 2018  路  5Comments  路  Source: edvin/tornadofx

Hi,

when executing the class Person.kt from the guide:

package de.auticon.maven.tornadofx

import javafx.beans.property.SimpleIntegerProperty
import javafx.beans.property.SimpleObjectProperty
import javafx.beans.property.SimpleStringProperty
import java.time.LocalDate
import java.time.Period

class Person(id: Int, name: String, birthday: LocalDate) {
val idProperty = SimpleIntegerProperty(id)
var id by idProperty

val nameProperty = SimpleStringProperty(name)
var name by nameProperty

val birthdayProperty = SimpleObjectProperty(birthday)
var birthday by birthdayProperty

val age: Int get() = Period.between(birthday, LocalDate.now()).years
}

I get the errors:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.0-rc-198:compile (compile) on project de-auticon-maven-tornadofx: Compilation failure: Compilation failure:
[ERROR]

C:\Users\Lap127\IdeaProjects\deauticonmaventornadofx\src\main\kotlin\deauticon\maventornadofx\Person.kt:[11,15] Property delegate must have a 'getValue(Person, KProperty<*>)' method. None of the following functions is suitable:
[ERROR] public open fun getValue(): Int! defined in javafx.beans.property.SimpleIntegerProperty
.
.
.

Process finished with exit code 1

Most helpful comment

You need to import tornadofx.* :)

All 5 comments

You need to import tornadofx.* :)

ty

You're welcome :) I've updated the guide to include the import.

BTW issue #677 is not resolved in the guide yet...

Done. There are too many readonlyColumn examples in the guide to my liking, I'd like to make most of them based on observable properties, since that's the best practice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leo-Thura picture Leo-Thura  路  6Comments

AlmasB picture AlmasB  路  8Comments

MairwunNx picture MairwunNx  路  8Comments

eibens picture eibens  路  4Comments

AlbRoehm picture AlbRoehm  路  3Comments