aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Show a PopupMenu using a hotkey Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Show a PopupMenu using a hotkey" Watch "Show a PopupMenu using a hotkey" New topic
Author

Show a PopupMenu using a hotkey

Mohit J Kumar
Greenhorn

Joined: Apr 08, 2010
Posts: 28

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.


"It's good to B in touch...So keep responding"
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38840
    
  23
Can you add a KeyListener or similar to your table? The underlined text leads to some links which look helpful.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4543
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Show a PopupMenu using a hotkey