• Post Reply Bookmark Topic Watch Topic
  • New Topic

KeyListener in JMenu  RSS feed

 
Jim Hamrick
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a container with a jframe, a jmenubar with a jmenu added. i have a keylistener added to a jbutton which is added to my container, and it all works. however, i want to add a keylistener to my jmenu, so that when the list pops up, maybe you can hit 'a' to have it jump to the items that start with a, etc etc. i tried jm.addKeyListener(this);, but under my keyTyped() method, nothing happens when the jmenu is open and i type keys. im fairly sure im using the code correctly, because keyTyped() is working for my jbutton, but not my jmenu. is there something specific i have to do in order to trigger keyevents from inside a jmenu? to make sure im being clear, im talking about typing inside the jmenu that pops up after you click on the jmenu (or in this case, run the jm.doClick() method. Thanks for your time.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not exactly sure about the answer to your question. You will probably have more luck asking in the GUI forum, if you haven't already. (And if you have, shame on you for cross posting!)

Layne
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed. I'll move this to the Swing/AWT forum for you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!