Depending on which buttons are inserted into a dialog, certain keystrokes will be mapped automatically:
These are the primary keystrokes that are mapped by the standard dialog and the standard buttons.
To add handling when these keystrokes are pressed, do the following:
For the Enter key, override the handleOk() method. If everything finishes correctly and the dialog needs to be released, then call super.handleOk(). This will ensure that the dialog shuts down properly.
For the Esc key, override the handleCancel() method. The standard dialog behavior closes the dialog, releases all the controls, disposes of contained components, and so on. In most cases, this method will not need to be overridden.
For the F1 key, override the handleHelp() method. If the dialog has been connected via the Administration Services help system via the normal manner, this step should not be necessary.
By default, the Java Swing implementation sets the focus order of controls to correspond to the order in which they were added to their container, and then those container’s to their container, and so on. This can be overridden by making a call to the method DialogUtils.setFocusOrder(). This mechanism should be used in all dialogs to ensure the focus order of controls is correct and doesn’t rely on how the code for building the containment models was written.