code: private void resizeNow() {
  		invalidate();
  		// find the validate root; adapted from the package-private SwingUtilities.getValidateRoot
  		Container root = null;
  		Container c=this;
  		for (; c != null; c = c.getParent()) {
  			if (!c.isDisplayable() || c instanceof CellRendererPane) {
  				return;
  			}
  			if (c.isValidateRoot()) {
  				root = c;
  				break;
  			}
  		}
  
  		if (root == null) return;
  
  		for (; c != null; c = c.getParent()) {
  			if (!c.isDisplayable() || !c.isVisible()) {
  				return;
  			}
  			if (c instanceof Window || c instanceof Applet) {
  				break;
  			}
  		}
  
  		if (c==null) return;
  		
  		root.validate();
  		repaint();
  	}
docs: Preforms all necessary actions to ensure that the viewer is resized to its proper size. It does that by invoking
  {@code validate()} on the viewer's validateRoot. It also issues a {@code repaint()}.