All Classes Namespaces Files Functions Variables
AutolaskuriController.java
Go to the documentation of this file.
1 package autolaskuri.bind;
2 
3 import java.net.URL;
4 import java.util.ResourceBundle;
5 
6 import javafx.beans.property.SimpleIntegerProperty;
7 import javafx.fxml.FXML;
8 import javafx.fxml.Initializable;
9 import javafx.scene.control.Label;
10 
11 /**
12  * Yksinkertainen autolaskuri, jossa painkikkeita painamalla
13  * voidaan kasvattaa laskureiden arvoja
14  * @author vesal
15  * @version 5.3.2016
16  */
17 public class AutolaskuriController implements Initializable {
18  @FXML private Label laskuriHA;
19  @FXML private Label laskuriKA;
20  private SimpleIntegerProperty ha = new SimpleIntegerProperty(0);
21  private SimpleIntegerProperty ka = new SimpleIntegerProperty(0);
22 
23  @Override
24  public void initialize(URL location, ResourceBundle resources) {
25  laskuriHA.textProperty().bind(ha.asString());
26  laskuriKA.textProperty().bind(ka.asString());
27  }
28 
29  @FXML void handleHA() {
30  ha.set(ha.get()+1);
31  }
32 
33  @FXML void handleKA() {
34  ka.set(ka.get()+1);
35  }
36 
37  @FXML void handleNollaa() {
38  ha.set(0);
39  ka.set(0);
40  }
41 
42 }