void () { ensureEventDispatchThread(); myValidationAlarm.cancelAllRequests(); myDisposed = true; for (JButton button : myButtonMap.values()) { button.setAction(null); // avoid memory leak via KeyboardManager } myButtonMap.clear(); JRootPane rootPane = getRootPane(); // if rootPane = null, dialog has already been disposed if (rootPane != null) { if (myActualSize != null && isAutoAdjustable()) { setSize(myActualSize.width, myActualSize.height); } myPeer.dispose(); } }