private void adjustRoots(JComponent root,java.util.List<Component> roots,int index){
  for (int i=roots.size() - 1; i >= index; i--) {
    Component c=roots.get(i);
    for (; ; ) {
      if (c == root || c == null || !(c instanceof JComponent)) {
        break;
      }
      c=c.getParent();
    }
    if (c == root) {
      roots.remove(i);
    }
  }
}

private void adjustRoots ( JComponent root , java . util . List < Component > roots , int index ) { for ( int i = roots . size ( ) - 1 ; i >= index ; i -- ) { Component c = roots . get ( i ) ; for ( ; ; ) { if ( c == root || c == null || ! ( c instanceof JComponent ) ) { break ; } c = c . getParent ( ) ; } if ( c == root ) { roots . remove ( i ) ; } } }
removes any components from roots that are children of root .
