• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

KeyListener in JMenu

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. I'll move this to the Swing/AWT forum for you.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic