@Override
    protected final Dimension calculateMinimumSize() {
        if (layoutManager == null) {
            final Inset i = getInset();
            int maxX = 0;
            int maxY = 0;
            for (Widget w : children) {
                if (!w.isVisible()) {
                    continue;
                }
                maxX = Math.max(maxX, (w.getX() + w.getWidth()));
                maxY = Math.max(maxY, (w.getY() + w.getHeight()));
            }
            return new Dimension(maxX - getX() + (i != null ? i.getHorizontalTotal() : 0), maxY - getY() + (i != null ? i.getVerticalTotal() : 0));
        }
        return layoutManager.getPrefferedSize(this);
    }