GUI development with Swing.
I have a custom dialog for choosing a file to be opened in my application; its class extends javax.swing.JDialog
and contains, among other components, a JFileChooser
, which can be toggled to be shown or hidden.
The JFileChooser
component already handles the ESC key by itself: when the file chooser is shown (embedded in my dialog) and I press ESC, the file chooser hides itself.
Now I would like my dialog to do the same: when I press ESC, I want the dialog to close. Mind you, when the embedded file chooser is shown, the ESC key should only hide it.
Any ideas ?