Dimension () { Dimension size = getSize(); if (size == null) { size = getStoredSize(); } if (size == null) { Dimension contentPreferredSize = myContent.getPreferredSize(); Dimension titlePreferredSize = getTitle().getPreferredSize(); size = new JBDimension(Math.max(contentPreferredSize.width, titlePreferredSize.width), contentPreferredSize.height + titlePreferredSize.height, true); } return size; }