Select Git revision
lambda.scala
Forked from
joel.cavat / scala2020
Source project has a limited visibility.
AskForBetController.java 947 B
package hepia;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
public class AskForBetController extends BlackJackController {
@FXML
private TextField inputBet;
@FXML
private Button btnSetBet;
@FXML
public void initialize() {
filterInputs(inputBet);
btnSetBet.disableProperty().bind(inputBet.textProperty().isEmpty());
}
private void filterInputs(TextField inputField) {
inputField.addEventFilter(javafx.scene.input.KeyEvent.KEY_TYPED, event -> {
if (!event.getCharacter().matches("[0-9]")) {
event.consume();
}
});
}
@FXML
protected void setHumanBet() {
Stage currentStage = (Stage) btnSetBet.getScene().getWindow();
currentStage.close();
humanPlayers.add(new HumanPlayer(Integer.parseInt(inputBet.getText())));
}
}