Dimension d; if (getOrientation() == VERTICAL) { d = new Dimension(getPreferredVerticalSize()); } else { d = new Dimension(getPreferredHorizontalSize()); d.height = insetCache.top + insetCache.bottom; d.height += preferredSize_.height; } return d;
if (getOrientation() == VERTICAL) return getPreferredVerticalSize(); int width = getPreferredHorizontalSize().width; int height = insetCache.top + insetCache.bottom; height += preferredSize_.height; return new Dimension(width, height);
    public Dimension getPreferredSize()    {         Dimension d;        if (getOrientation() == VERTICAL) {            d = new Dimension(getPreferredVerticalSize());        } else {            d = new Dimension(getPreferredHorizontalSize());            d.height = insetCache.top + insetCache.bottom;            d.height += preferredSize_.height;        }        return d;    }