Skip to content

Instantly share code, notes, and snippets.

@BMU-Verlag
Created October 10, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMU-Verlag/26eec577f8bab4fbee9944a0e64491ba to your computer and use it in GitHub Desktop.
Save BMU-Verlag/26eec577f8bab4fbee9944a0e64491ba to your computer and use it in GitHub Desktop.
@FXML
void prepareOperation(ActionEvent event) {
if (event.getSource() == add) {
nextOperation = Operation.add;
} else if (event.getSource() == substract) {
nextOperation = Operation.substract;
} else if (event.getSource() == multiply) {
nextOperation = Operation.multiply;
} else if (event.getSource() == divide) {
nextOperation = Operation.divide;
}
if (!input.getText().isBlank() && !lastResult.getText().isBlank()) {
evaluate();
} else if (!input.getText().isBlank()){
lastResult.setText(input.getText());
input.setText("");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment