public void add(Component comp,Object constraints){
  if (comp == null) {
    throw new RuntimeException("Can't add null component to DockPanel");
  }
  if (comp instanceof DockWrapper) {
    Debug.error("DockPanel: Unexpected call to add with a DockWrapper");
    super.add(comp,constraints);
  }
 else {
    if (constraints.equals(BACKGROUND)) {
      background=(JComponent)comp;
      super.add(comp,constraints);
      setLayer(comp,BACKGROUND_LAYER.intValue());
    }
 else     if (constraints instanceof DockConstraint) {
      if (comp instanceof JToolBar) {
        JToolBar t=(JToolBar)comp;
        t.setFloatable(false);
      }
      setConstraint((JComponent)comp,(DockConstraint)constraints);
      if (!alreadyAdded(comp)) {
        createDockWrapper((JComponent)comp);
      }
    }
 else {
      Debug.error("DockPanel: Unexpected constraint: " + constraints);
    }
  }
}

public void add ( Component comp , Object constraints ) { if ( comp == null ) { throw new RuntimeException ( "Can't add null component to DockPanel" ) ; } if ( comp instanceof DockWrapper ) { Debug . error ( "DockPanel: Unexpected call to add with a DockWrapper" ) ; super . add ( comp , constraints ) ; } else { if ( constraints . equals ( BACKGROUND ) ) { background = ( JComponent ) comp ; super . add ( comp , constraints ) ; setLayer ( comp , BACKGROUND_LAYER . intValue ( ) ) ; } else if ( constraints instanceof DockConstraint ) { if ( comp instanceof JToolBar ) { JToolBar t = ( JToolBar ) comp ; t . setFloatable ( false ) ; } setConstraint ( ( JComponent ) comp , ( DockConstraint ) constraints ) ; if ( ! alreadyAdded ( comp ) ) { createDockWrapper ( ( JComponent ) comp ) ; } } else { Debug . error ( "DockPanel: Unexpected constraint: " + constraints ) ; } } }
we need to handle adding the component specially . if it is the background , do one thing . otherwise wrap it up . . .
