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 ; }
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 .