void () { if (isDisposed()) return; Dimension prefSize = getPreferredSize(); Dimension minSize = getRootPane().getMinimumSize(); int height = Math.max(prefSize.height, minSize.height); setSize(prefSize.width, height); }