I am using JDK version 1.3.1, and I have a couple of questions about the Swing
JToolBar class. I realize this is an AWT group, but I couldn't see a better
group to post it in.

Basically, I am attempting to create a customizable toolbar for my users.
I want them to be able to specify which buttons appear on the toolbar, or
even to remove the toolbar all together. Further, I want the toolbar to
be "floatable", and all changes should be reflected by the toolbar whether
it is docked or floating. At first, I thought the biggest problem would
be finding a way to detect whether the toolbar is docked or floating, but
that turned out to be fairly easy (with HierarchyListener).

Here are the issues I am encountering:

1. Is there any way to determine the current position (NORTH, SOUTH, EAST,
WEST) of a docked toolbar (when using BorderLayout)? I haven't been able
to find one yet.

2. When the toolbar is docked in the EAST or WEST positions, changes (adding/removing
buttons) result in strange behavior (it's hard to describe, but it's definitely
not normal). Only by moving the toolbar back to NORTH can I clean it up.
I think this might be solvable if I could detect the toolbar position (see
number 1).

3. When the toolbar is floating, it does not seem to respond to various
messages (for example, setVisible()). Also, I would like to be able to dynamically
re-size the floating toolbar, based on the number of buttons it contains.
What is the best way to manipulate the toolbar when it is floating?

4. From what I can tell, JToolBar (at least in earlier versions of the JDK)
contains a "bug" which causes the layout to be reset to (I believe) BoxLayout
whenever it is manipulated. Has this been fixed, or is there a way around
it? I would like to change the layout manager to something like GridLayout
when the toolbar is floating, to have a more appropriate toolbar shape (a
box instead of all the buttons in a line). Currently, making this change
doesn't seem to have any effect.

So, basically, what I am looking for is some information on advanced programming
with JToolbar. If anyone can point me to books or other documentation that
contain such information, I would be very grateful.


Carl Rapson