Toolbar with groups

Hi,

I want to create a toolbar where the user can select the group of tools visible. Something like this: http://doc.trolltech.com/qq/qq07-qt32-an-even-better-qt.html#newtoolboxwidget

Any idea how I can do it? Or screenshots of Swing toolbars with similar functionalities? How to manage horizontal display?

Well, any idea welcome...

[357 byte] By [genepia] at [2007-9-30 2:19:11]
# 1
well, that looks like a menu or popup menu, where they've added imageicon to the labels of the menuitem.
krrajesh2a at 2007-7-16 13:28:03 > top of Java-index,Archived Forums,Swing...
# 2
Looks like they have added submenus as dynamic menuitems.
bbrittaa at 2007-7-16 13:28:03 > top of Java-index,Archived Forums,Swing...
# 3

Honestly, it looks like you could easily just use a Box, BoxLayout, Or GridBagLayout and some well set up JLabels to reproduce the functionality of the pic on the left. Just use a MouseListener (and maybe a MouseMotionListener for rollover effect) for interaction.

The pic on the right would be harder and would need some custom painting.

Hope this helps,

Josh Castagno

http://www.jdc-software.com

Josh_Castagnoa at 2007-7-16 13:28:03 > top of Java-index,Archived Forums,Swing...
# 4

Hi,

I managed to get the best appearance using Boxes and JLabels, under Win2K, as you suggested.

JToolbar is not a good choice because it's stubborned to display horizontally when teared off, even when created with a vertical layout (I would call this a bug). And experiments with JMenu or JPopupMenu didn't give the expected result...

Now, I've a layout question: how to get the group headers to stick at the top or the bottom of the Box?

When the first group is opened, the header must be at the top, displaying all the tools in that group. All other headers must be at the bottom.

When the user select another group, the first group closes, and all the headers down to the one selected move to the top, to show the tools of the selected group. Other headers stick on the bottom...

I'm fighting with Box glue and layout manager to get this behaviour...

genepia at 2007-7-16 13:28:03 > top of Java-index,Archived Forums,Swing...