private void setSizes(Container parent) {
		int count = parent.getComponentCount();
		Insets insets = parent.getInsets();
		if (parent instanceof JPanel) {
			insets = new Insets(0, 0, 0, 0);
		}
		int insetWidth = 0;
		int insetHeight = 0;
		if (insets != null) {
			insetWidth = insets.left + insets.right;
			insetHeight = insets.top + insets.bottom;
		}
		Dimension dimension = null;
		preferredWidth = 0;
		preferredHeight = 0;
		minWidth = 0;
		minHeight = 0;
		for (int index = 0; index < count; index++) {
			Component component = parent.getComponent(index);
			if (component != null && component.isVisible()) {
				dimension = component.getPreferredSize();
				if (dimension == null) {
					dimension = component.getMinimumSize();
				}
				if (preferredWidth < component.getX() + dimension.width + hgap) {
					preferredWidth = component.getX() + dimension.width + hgap;
				}
				if (preferredHeight < component.getY() + dimension.height + vgap) {
					preferredHeight = component.getY() + dimension.height + vgap;
				}
			}
		}
		preferredWidth += hgap;
		preferredWidth += insetWidth;
		preferredHeight += vgap;
		preferredHeight += insetHeight;
		minHeight = preferredHeight;
		minWidth = preferredWidth;
	}