component.revalidate();   if (component.getParent() != null) component.getParent().repaint(); else component.repaint();
  public void setBoundsForFrame(JComponent component, int newX, int newY,                                int newWidth, int newHeight)  {    component.setBounds(newX, newY, newWidth, newHeight);    component.revalidate();    // If not null, I'd rather repaint the parent    if (component.getParent() != null)      component.getParent().repaint();    else      component.repaint();  }