Dimension () { final Dimension preferredSize = super.getPreferredSize(); final Dimension borderSize = myBorder.getMinimumSize(this); return new Dimension( Math.max(preferredSize.width, borderSize.width + 10), Math.max(preferredSize.height, borderSize.height) ); }