-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.1, 1.2.0, 1.2.2
-
generic, sparc
-
generic, solaris_2.5, solaris_2.5.1
The SwingSet demo shows that the JToolBar can be docked at four sides of the containing frame. This seems to work only if the LayoutManager of the containing
Container is BorderLayout. If the LayoutManager is changed to any other strange things happen.
I can see why the BorderLayout was used to implement this docking behaviour, but it needs to be documented.
Assuming that the user added a component to the container using BorderLayout.EAST constraint, if the ToolBar is undocked and docked at the right
edge it clobbers the user added component.
Try the attached program with BorderLayout and GridLayout.
Name: skT88420 Date: 09/17/99
I noticed that after docking the tool bar at the left or right
of my window I wasn't able to dock it elsewhere than at the top!
After haveing docked at the top everything worked ok until I docked
it at the right or left again.
Now I found the problem in the BasicToolBarUI and it's because u didn't
take in account that a toolbar has two orientations! ;-)
Take a look at this
dockingSensitivity = toolBar.getSize().height;
this works if the tool bars orientation is horizontal
but for a vartical tool bar the resulting value is a little bit to
big.
Now I changed it to:
dockingSensitivity = toolBar.getOrientation() == JToolBar.HORIZONTAL ? toolBar.getSize().height : toolBar.getSize().width;
And now everything works as aspected, at least like I aspect it to work ;-)
Thanks
Patrick
(Review ID: 95379)
======================================================================
Container is BorderLayout. If the LayoutManager is changed to any other strange things happen.
I can see why the BorderLayout was used to implement this docking behaviour, but it needs to be documented.
Assuming that the user added a component to the container using BorderLayout.EAST constraint, if the ToolBar is undocked and docked at the right
edge it clobbers the user added component.
Try the attached program with BorderLayout and GridLayout.
Name: skT88420 Date: 09/17/99
I noticed that after docking the tool bar at the left or right
of my window I wasn't able to dock it elsewhere than at the top!
After haveing docked at the top everything worked ok until I docked
it at the right or left again.
Now I found the problem in the BasicToolBarUI and it's because u didn't
take in account that a toolbar has two orientations! ;-)
Take a look at this
dockingSensitivity = toolBar.getSize().height;
this works if the tool bars orientation is horizontal
but for a vartical tool bar the resulting value is a little bit to
big.
Now I changed it to:
dockingSensitivity = toolBar.getOrientation() == JToolBar.HORIZONTAL ? toolBar.getSize().height : toolBar.getSize().width;
And now everything works as aspected, at least like I aspect it to work ;-)
Thanks
Patrick
(Review ID: 95379)
======================================================================
- duplicates
-
JDK-4121153 Docking JToolBar causes IllegalArgumentException if GridBagLayout is being used
- Closed
- relates to
-
JDK-4251592 JToolBar should reject setLayout() if it will always revert to BoxLayout
- Resolved