java - How to listen to keypress events in a jdialog container? -


i have jdialog contains many rows of textfields , submit button. know if it's possible add eventlistener container trigger submit button.

one convenient way bind enter action via root pane's setdefaultbutton() method. can use action in key binding, shown here.

jdialog d = new jdialog(…); action submit = new abstractaction("submit") {      @override     public void actionperformed(actionevent e) {         // handle submit     } }; private jbutton b = new jbutton(submit); … d.getrootpane().setdefaultbutton(b); 

Comments

Popular posts from this blog

java - Incorrect order of records in M-M relationship in hibernate -

command line - Use qwinsta in PowerShell ISE -

php - I want to create a website for polls/survey like this http://www.poll-maker.com/ -