private int findWindowPosition(String window){
  int loc=windowOrder.indexOf(window);
  if (loc != -1) {
    int i=0;
    for (    Component c : panel.getComponents()) {
      if (c instanceof ManagedWindow) {
        String name=c.getName();
        if (loc < windowOrder.indexOf(name)) {
          return i;
        }
      }
      i++;
    }
  }
 else {
    windowOrder.add(window);
    fireWindowOrderChanged();
  }
  return panel.getComponentCount();
}

private int findWindowPosition ( String window ) { int loc = windowOrder . indexOf ( window ) ; if ( loc != - 1 ) { int i = 0 ; for ( Component c : panel . getComponents ( ) ) { if ( c instanceof ManagedWindow ) { String name = c . getName ( ) ; if ( loc < windowOrder . indexOf ( name ) ) { return i ; } } i ++ ; } } else { windowOrder . add ( window ) ; fireWindowOrderChanged ( ) ; } return panel . getComponentCount ( ) ; }
find the correct position to add a named component .
