I have tried to make a Dialog Close when I press ESC and accept when I press ENTER. So I have build a superclass "CloseableDialog" using Input/ActionMap like this:
getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "accept");
getRootPane().getActionMap().put("accept", acceptAction);
getRootPane().getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
getRootPane().getActionMap().put("cancel", cancelAction);
Now I built several Dialogs extending CloseableDialog. It works as aspected at first time (closing when pressing ESC, accepting when press ENTER), but when I opened a SubDialog (Dialog in Dialog) only the Subdialog was closeable by pressing ESC (ESC -> SubDialog closes, other Dialog Visible -> ESC-> nothin happens).
Any ideas?
I think, the diposed SubDialog gets still the inputs of the other Dialog, but I am not sure.