JavaFX 2.0 loading fxml files with event handlers fails

后端 未结 1 941
悲&欢浪女
悲&欢浪女 2021-01-21 04:42

i am trying to load a fxml from a subfolder, but it fails. I have the line that make the replace scene content:

private Parent replaceSceneContent(String fxml) t         


        
相关标签:
1条回答
  • 2021-01-21 05:21

    If you are defining an action of Button in FXML file like this:

     <Button text="Login" onAction="#processLogin"/>
    

    then you must define a method in the controller class like as following. Note the signature of processLogin:

        @FXML
        private void processLogin(javafx.event.ActionEvent event) {
            // Process Login
        }
    
    0 讨论(0)
提交回复
热议问题