private void centerComponents() { Rectangle bounds = getBounds(); Point point = imageComponent.getLocation(); point.x = (bounds.width - imageComponent.getWidth()) / 2; point.y = (bounds.height - imageComponent.getHeight()) / 2; imageComponent.setLocation(point); }