• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hot key doesn't work?  RSS feed

 
Zee Ho
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order to make the user feel covenient to use the UI, I try to make the VK_ENTER as the hot key of ok button.
I've tried the three way to do it.

add the key listener to JFrame - doesn't work

overide processKeyEvent method --- doesn't work

add key listener to every focusable component -- work, but cumbersome. I want to know whether the 3rd one is the only solution? and how to fire the action? do I need to let it invoke the same method of ButtonListener? I wonder there's something like the onclick method...
 
Lionel Badiou
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Zee Ho,

You might try to use instead (in your frame/dialog's scope).

Hope that helps,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!