This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Greenhorn

Joined: Apr 08, 2010
Posts: 28

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: 10167
    
    8

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
Greenhorn

Joined: Apr 08, 2010
Posts: 28


Hi,
Thanks for replying.
Actually I was thinking if it's possible to do so.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Accelerator key for JToolBar
 
Similar Threads
FBN: Acclerator Keys
Key accelerator steals focus from textFields?
Key accelerator question
WA #2 ..... word association
how to give focus to a component ?