This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding KeyListener  RSS feed

 
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: 21095
85
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!