protected void dispose() {
synchronized (ourLock) {
final JRootPane rootPane = getRootPane();
// if rootPane = null, dialog has already been disposed
if (rootPane != null) {
new AwtVisitor(rootPane) {
public boolean visit(final Component component) {
if (component instanceof JComponent) {
final JComponent eachComp = (JComponent)component;
final KeyStroke[] strokes = eachComp.getRegisteredKeyStrokes();
for (KeyStroke eachStroke : strokes) {