I using JavaFx for first time and I encountered a problem with events. I built a form with SceneBuilder and I add an event on .fxml and controller but it\'s always return w
Try using KeyEvent
instead of ActionEvent
@FXML
private void newButtonClick(KeyEvent event) { ...}
If you want to use a mouseClicked
event, simply change your newButtonClicked
method to take in MouseEvent
@FXML
private void newButtonClick(MouseEvent event){...}
Use onAction="#newButtonClick"
, not onMouseClicked
.
instead of onMouseClicked you should use onAction