question: public void add ( String key , Tool item , int index ) { int orientation = getOrientation ( ) ; boolean hOrient = orientation == SwingConstants . HORIZONTAL ; item . setOrientation ( orientation ) ; Container face = item . getFace ( ) ; if ( face != null ) { face . addComponentListener ( this ) ; items . put ( key . intern ( ) , item ) ; if ( autoSpace ) { index *= 2 ; } if ( hOrient ) { c . weightx = 0 ; c . gridx = getNextAvailableIndex ( index ) ; c . gridy = 0 ; c . anchor = GridBagConstraints . WEST ; } else { c . weighty = 0 ; c . gridx = 0 ; c . gridy = getNextAvailableIndex ( index ) ; c . anchor = GridBagConstraints . NORTH ; } gridbag . setConstraints ( face , c ) ; add ( face ) ; if ( filler == null ) { if ( hOrient ) { c . gridx = getNextAvailableIndex ( MAX_INDEXES ) ; c . anchor = GridBagConstraints . EAST ; c . weightx = 1 ; } else { c . gridy = getNextAvailableIndex ( MAX_INDEXES ) ; c . anchor = GridBagConstraints . SOUTH ; c . weighty = 1 ; } filler = new JLabel ( "" ) ; gridbag . setConstraints ( filler , c ) ; add ( filler ) ; } if ( autoSpace ) { JLabel l = new JLabel ( " " ) ; gridbag . setConstraints ( l , c ) ; add ( l ) ; } } setVisibility ( ) ; firePropertyChange ( MembershipProperty , null , items ) ; }
target:  Add an item to the tool bar.