RosettaCodeData/Task/Simple-windowed-application/JavaFX-Script/simple-windowed-application...

26 lines
591 B
Plaintext

import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
Stage {
scene: Scene {
width: 300 height: 200
content: VBox {
var clicks: Integer;
spacing: 10
content: [
Label {
def varText = bind if (clicks == 0) then "no clicks yet" else "{clicks} clicks"
text : bind "There have been {varText}"
}
Button {
text: "click me"
onMouseClicked: function(e) { clicks++; }
}
]
}
}
}