File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Accelerator key for JToolBar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Accelerator key for JToolBar" Watch "Accelerator key for JToolBar" New topic
Author

Accelerator key for JToolBar

Mohit J Kumar
Ranch Hand

Joined: Apr 08, 2010
Posts: 33

Hi all,
Is there any way to attach an accelerator key to JToolBar buttons.
I don't want to make corresponding menu-items for every toolbar button to achieve this.
Thanks.


"It's good to B in touch...So keep responding"
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

mohit chilkoti wrote:
I don't want to make corresponding menu-items for every toolbar button to achieve this.


Why? What problem are you trying to avoid by taking this approach?
In theory, I suppose you can achieve it by using key bindings. But that is a horrible design in my opinion.
The accelerators are for the buttons/menus. It makes sense to have the accelerator code with those items.

PS.
Usually the toolbar displays visual representation of items, which are already present with in the menu bar.
Then it makes even more sense to have similar items share the same subclassed AbstractAction


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Mohit J Kumar
Ranch Hand

Joined: Apr 08, 2010
Posts: 33


Hi,
Thanks for replying.
Actually I was thinking if it's possible to do so.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accelerator key for JToolBar