code: protected static void removeChildAndPrevious( JComponent root , JComponent target ) {
  		int N = root.getComponentCount();
  
  		for (int i = 0; i < N; i++) {
  			if( root.getComponent(i) == target ) {
  				root.remove(i);
  				root.remove(i-1);
  				return;
  			}
  		}
  		throw new RuntimeException("Can't find component");
  	}
docs: Searches inside the children of "root" for 'target'. If found it is removed and the
  previous component.