code: public static Object resolveToolbarConstraint(JToolBar toolbar) {
          /*
           * NOTE: we don't worry about component orientation or PAGE_END etc
           * because the BasicToolBarUI always uses an absolute position of
           * NORTH/SOUTH/EAST/WEST.
           */
          if (toolbar != null) {
              Container parent = toolbar.getParent();
  
              if (parent != null) {
                  LayoutManager m = parent.getLayout();
  
                  if (m instanceof BorderLayout) {
                      BorderLayout b   = (BorderLayout) m;
                      Object       con = b.getConstraints(toolbar);
  
                      if (con == SOUTH || con == EAST || con == WEST) {
                          return con;
                      }
  
                      return NORTH;
                  }
              }
          }
  
          return NORTH;
      }
docs: Package private method which returns either BorderLayout.NORTH,
  BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending on
  the location of the toolbar in its parent. The toolbar might be in
  PAGE_START, PAGE_END, CENTER, or some other position, but will be
  resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
  actually IS, with CENTER being NORTH.
  
  <p/>This code is used to determine where the border line should be drawn
  by the custom toolbar states, and also used by SeaGlassIcon to determine
  whether the handle icon needs to be shifted to look correct.</p>
  
  <p>Toollbars are unfortunately odd in the way these things are handled,
  and so this code exists to unify the logic related to toolbars so it can
  be shared among the static files such as SeaGlassIcon and generated files
  such as the ToolBar state classes.</p>
  
  @param  toolbar a toolbar in the Swing hierarchy.
  
  @return the {@code BorderLayout} orientation of the toolbar, or
  {@code BorderLayout.NORTH} if none can be determined.