• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

JList selection change with button Mnemonic

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All, I'm fairly new to the Java World.
I have a dialog with buttons(which have mnemonics) and with a JList. When I attempt to invoke buttons via the mnemonics via the alt key the JList selection is changing as well.
I could probably handle key input in my JList class and detect if the Alt key is pressed however the my entire application is littered with dialogs with the same scenerio.
I would like to resolve this problem in one spot if possible. Could this be done using the UIManager?
Thanks in advance,
Rob.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you specifically adding key listeners to your JLists? I didn't think they changed selection upon key entry by default (except arrow keys).
If you are adding key listeners individually, either check for Alt there or (better yet, if the functionality is common), create your own class which extends JList, do the stuff you want in there, and then search/replace instances of JList with your class.
Bill
 
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic