question: public void addLeaf ( String name , String path ) { NamedIcon icon = NamedIcon . getIconByName ( path ) ; if ( icon == null ) { log . warn ( "path \"" + path + "\" is not a NamedIcon." ) ; return ; } int h = icon . getIconHeight ( ) ; for ( int i = 0 ; i < _leaves . size ( ) ; i ++ ) { CatalogTreeLeaf leaf = _leaves . get ( i ) ; if ( h < leaf . getSize ( ) ) { _leaves . add ( i + 1 , new CatalogTreeLeaf ( name , path , h ) ) ; return ; } } _leaves . add ( new CatalogTreeLeaf ( name , path , h ) ) ; }
target:  Insert leaf according to height.