button listener

Hello

I have a button "myButton" in JPanel. To handle an action when user clicks this button, I have

myButtonActionPerformed(java.awt.event.ActionEvent evt){

doAction();

}

Now I want that when user press Enter key, I can also do action "doAction()" as when user click button "myButton"

Please help

regards

shuhu

[366 byte] By [suhua] at [2007-11-27 6:31:33]
# 1
[url= http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html]How to write a KeyListener[/url][url= http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to use Key Bindings[/url]
CaptainMorgan08a at 2007-7-12 17:56:27 > top of Java-index,Java Essentials,Java Programming...