public void addUI(Component component,int buffer,int width,int height){
  if (fieldPanel != null) {
    int lastX=-1;
    for (    Component c : fieldPanel.getComponents()) {
      int x=c.getX() + c.getWidth();
      if (x > lastX) {
        lastX=x;
      }
    }
    component.setBounds(lastX + buffer,0,width,height);
    fieldPanel.add(component);
  }
}

public void addUI ( Component component , int buffer , int width , int height ) { if ( fieldPanel != null ) { int lastX = - 1 ; for ( Component c : fieldPanel . getComponents ( ) ) { int x = c . getX ( ) + c . getWidth ( ) ; if ( x > lastX ) { lastX = x ; } } component . setBounds ( lastX + buffer , 0 , width , height ) ; fieldPanel . add ( component ) ; } }
adds the ui component to the field panel .
