2

Is there a widget for making configurable toolbar in java ?

Couldnt find anything in swingx but seems a common problem

Paul Taylor
  • 13,411
  • 42
  • 184
  • 351
  • 3
    What do you mean by "configurable"? Best to explain why [`javax.swing.JToolBar`](http://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/JToolBar.html) isn't suitable for you. – David Webb Mar 29 '13 at 10:42
  • @Dave Webb JToolBar is fine, but I mean is I need to create a dialog to allow user to modify the toobar, add/remove tasks, change shortcut keys, icons ecetera. – Paul Taylor Mar 29 '13 at 10:48
  • 1
    just ... do it? Can't see much of a wide-spread need for such a dialog ... – kleopatra Mar 29 '13 at 10:58
  • "seems a common problem" really ? You could enhance your question with externals links/resources. – gontard Mar 29 '13 at 11:01
  • I am just just doing it, but I dont understand why no ones sees a need, most applications allow you to full configure a toolbar these days. I just checked some applications on my mac - Thunderbird, Firefox, Preview, IntelliJ, – Paul Taylor Mar 29 '13 at 11:15
  • @gonard I can't find any resources, that was the question ! – Paul Taylor Mar 29 '13 at 11:15
  • cool - once you did it, you might consider contributing to SwingX :-) – kleopatra Mar 29 '13 at 11:52
  • @kleopatra sure, I've contributed a couple of minor things in the past – Paul Taylor Mar 29 '13 at 12:06

1 Answers1

1

Use instances of Action to expose your application's functionality. Add these actions to your toolbar buttons. Because JToolBar is a Container you can add() and remove() buttons as needed in your toolbar editor by invoking revalidate() and repaint(). You can persist the current settings as suggested here.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Thanks, yes that is along the same lines of what Im doing – Paul Taylor Mar 29 '13 at 12:07
  • I usually just go for a basic editor with check boxes; [*Arachnophilia*](http://en.wikipedia.org/wiki/Arachnophilia) has an interesting interface; at the high end, [`JHotDraw`](http://www.jhotdraw.org/) configures the toolbars dynamically based on context. – trashgod Mar 29 '13 at 12:49