Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4107628

JToolBar docking on the sides works only if LayoutManager is BoderLayout.


    • Subcomponent:
    • CPU:
      generic, sparc
    • OS:
      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

      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 ;-)

      (Review ID: 95379)


          Issue Links



              • Assignee:
                gsaab Georges Saab
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: