Task

Create a window that has:

   a label that says   "There have been no clicks yet" 
   a button that says   "click me"


Upon clicking the button with the mouse, the label should change and show the number of times the button has been clicked.




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++; }
            }
         ]
      }
   }
}