public void layoutContainer(Container parent) { if (parent.countComponents() == 1) {   Component c = parent.getComponent(0); }
public void layoutContainer(Container parent) { JViewport vp = (JViewport)parent; Component view = vp.getView(); Rectangle portBounds = vp.getBounds(); Dimension viewMinimum = view.getMinimumSize(); int width = Math.max(portBounds.width, viewMinimum.width); int height = Math.max(portBounds.height, viewMinimum.height); int x = Math.min(0, portBounds.width - width); int y = Math.min(0, portBounds.height - height);  vp.setViewPosition(new Point(x, y)); vp.setViewSize(new Dimension(width, height));
	public void layoutContainer(Container parent) {          if (parent.countComponents() == 1)            {              // This should usually be true, but if it's not it is              // probably nicer if we do not panic.              Component c = parent.getComponent(0);            }	}