Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show a PopupMenu using a hotkey

 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is it possible to show a popup menu using a hotkey like "Alt Shift a"?
I have a table on which I am able to display a popup menu on right click.
I want to do it using some hotkey.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you add a KeyListener or similar to your table? The underlined text leads to some links which look helpful.
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use key bindings, which give you more flexibility than a KeyListener.
From http://download.oracle.com/javase/tutorial/uiswing/misc/keybinding.html
JComponent.WHEN_IN_FOCUSED_WINDOW
The component's window either has the focus or contains the component that has the focus. This input map is commonly used for mnemonics or accelerators, which need to be active regardless of where focus is in the window.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic