Im trying to refresh the image of an imageview on a button clink, but it doesnt seems like its working. Here is my code:
class MasterView : View("Master View") {
val controller: MyController by inject()
val currentenemy = SimpleIntegerProperty(0)
override val root = borderpane() {
right = imageview(controller.monsters[currentenemy.value]) {
setFitHeight(250.0)
setFitWidth(175.0)
}
center = button("Change image") {
action { currentenemy.value += 1 }
}
}
}
class MyController: Controller() {
val monsters = FXCollections.observableArrayList("slime.png", "goblin.png", "mage.png", "knight.png", "boss.png")
}
I know that the values are changeing, but the imageview doesn't seem to care about it.