简体   繁体   中英

javafx scene builder action handler for text field

I have a method in my controller class for auto completion functionality of text field. That method is connected to the text field in the scene builder but it's not working because i'm not passing correct parameter for event handling in my method. I have tried the following:

  • autoComplete(ActionEvent event)
  • autoComplete(KeyEvent event)

Can anyone tell what parameter should i pass to fix this problem?

Try to listen for change in the text and do the autocompletion logic afterwards

textField.textProperty().addListener( e -> {
    System.out.println(textField.getText());
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM