Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accelerator key for JToolBar

 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mohit J Kumar
Ranch Hand
Posts: 33
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
Thanks for replying.
Actually I was thinking if it's possible to do so.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic