dismissButton.addKeyListener
( new KeyAdapter()
{
/**
* Handle Dismiss button getting a function key,
* treat like a dismiss Button click
*
* @param e event giving details
*/
public void keyPressed ( KeyEvent e )
{
dismiss();
}
/**
* Handle Dismiss button getting an ordinary keystroke,
* treat like a dismiss Button click
*
* @param e event giving details
*/
public void keyTyped ( KeyEvent e )
{
dismiss();
}
...
/**
* Shutdown the Dialog box
*/
void dismiss()
{
this.setVisible( false );
this.dispose();
}