Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList selection change with button Mnemonic  RSS feed

 
Rob Elliott
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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.
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!