JavaFx Event argument type mismatch

后端 未结 4 2058
悲&欢浪女
悲&欢浪女 2020-12-06 17:50

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

相关标签:
4条回答
  • 2020-12-06 18:23

    Try using KeyEvent instead of ActionEvent

    @FXML
    private void newButtonClick(KeyEvent event) { ...}
    
    0 讨论(0)
  • 2020-12-06 18:26

    If you want to use a mouseClicked event, simply change your newButtonClicked method to take in MouseEvent

    @FXML
    private void newButtonClick(MouseEvent event){...}
    
    0 讨论(0)
  • 2020-12-06 18:38

    Use onAction="#newButtonClick", not onMouseClicked.

    0 讨论(0)
  • 2020-12-06 18:38

    instead of onMouseClicked you should use onAction

    0 讨论(0)
提交回复
热议问题