• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accelerator keys for Pop Up menu-items

 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to set accelerator keys to pop up menu items.
I have a pop up menu on JTable and I want to set accelerator keys to its menu items. I also want to display the accelerator keys on the menu item's label, exactly the same way as they are displayed in case of menu-bar.
(see the File menu(items) above on your browser).
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you add to the JMenu and the JPopupMenu are the same object; JMenuItem so you can set the accelerator.
Check out the JMenuItem API for method to set accelerator.
Recommended reading: http://download.oracle.com/javase/tutorial/uiswing/components/menu.html
 
Rob Camick
Ranch Hand
Posts: 2565
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also want to display the accelerator keys on the menu item's label,


This works fine for me. Post your SSCCE that demonstrates the problem

Is there any way to set accelerator keys to pop up menu items.


You can try using Key Bindings. I would guess that yo would need to bind the Action to the root pane.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic