I am incorporating a popup menu in my java application.
I have added a mouse listener to show it up and I have also registed a keyboard action with the key event KeyEvent.VK_CONTEXT_MENU
, that brings it up as well.
Problem is that the popup has no focus when it gets to be shown. I can't use the up and down arrows in order to walk it through. In fact, it can be operated only with the mouse (which takes the stinger from my wish to operate my system using the keyboard only...).
I could not find any useful information on that issue over the net, and have already read the java tutorials entry on menu. I also tried the following (each on its own, and cooperated), and none of them worked:
- Calling
popupmenu.requestFocusInWindow()
before and after theshow
is invoked. - Calling
popupmenu.setSelected(firstMenuItemObjectInstance)
before and after theshow
is invoked. - Calling
firstMenuItemObjectInstance.requestFocusInWindow()
before and after theshow
is invoked.
any ideas ?