3

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 the show is invoked.
  • Calling popupmenu.setSelected(firstMenuItemObjectInstance) before and after the show is invoked.
  • Calling firstMenuItemObjectInstance.requestFocusInWindow() before and after the show is invoked.

any ideas ?

aviad cohen
  • 637
  • 1
  • 6
  • 16

0 Answers0