Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

KeyListener and InputMap Confusion

807589Oct 29 2008 — edited Oct 30 2008
Okay I've been trying to look around the web and find out how to use a
KeyListener
to bring up say, a help dialog at any time...
I have tried a few examples and found that focus is necessary in order to trigger the KeyPressed Event for that component. I also read that manipulating focus would be the wrong approach. I read you can use an InputMap and ActionMap, however I cannot find any decent source code examples for this. \

At any time in my program...
Pressing "Q", should bring up a quit dialog.

or Pressing "F1" should bring up help, not only when there is focus though!.. please help
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 27 2008
Added on Oct 29 2008
16 comments
936 views