• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding KeyListener

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I used a JButton in an application, which handles a particular function but i can only click it mouse how can i use or activate the enter key. So that i can handle it from keyboard also.
Thanks and Regards.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried creating a simple form with just a few controls? And then pressing Tab until the focus is on the JButton? Because that should work just fine.

Alternatively, you can set a button's mnemonic which will allow you to press Alt+<mnemonic> to activate the button.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!