-
Enhancement
-
Resolution: Unresolved
-
P4
-
5.0
-
Cause Known
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
XP SP2
A DESCRIPTION OF THE PROBLEM :
On Windows it is common behaviour that dialogs are closing themselved as soon as the ESC key is pressed, since ESC is a common shortcut for the "Cancel" action.
The documentation of Swing contains information that there is a key binding for ESC in the Windows L&F which will retract the dialog:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/doc-files/Key-Windows.html#JDialog
Unfortunately, it seems the key binding is actually missing, since a JDialog doesn't do anything when someone presses the ESC key.
Find the following discussion on this:
http://forum.java.sun.com/thread.jspa?threadID=468363&messageID=2157528
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Write a small program that just shows a JDialog.
Do not write code for handling the ESC key.
Press ESC.
Look what happens.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Once ESC was pressed, the dialog shall close.
ACTUAL -
Once ESC was pressed, nothing happened.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There are no errors reported.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class X {
public static final void main(String[] a) {
(new JDialog()).show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You need to add code to each dialog that handles the ESC key.
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
XP SP2
A DESCRIPTION OF THE PROBLEM :
On Windows it is common behaviour that dialogs are closing themselved as soon as the ESC key is pressed, since ESC is a common shortcut for the "Cancel" action.
The documentation of Swing contains information that there is a key binding for ESC in the Windows L&F which will retract the dialog:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/doc-files/Key-Windows.html#JDialog
Unfortunately, it seems the key binding is actually missing, since a JDialog doesn't do anything when someone presses the ESC key.
Find the following discussion on this:
http://forum.java.sun.com/thread.jspa?threadID=468363&messageID=2157528
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Write a small program that just shows a JDialog.
Do not write code for handling the ESC key.
Press ESC.
Look what happens.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Once ESC was pressed, the dialog shall close.
ACTUAL -
Once ESC was pressed, nothing happened.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There are no errors reported.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class X {
public static final void main(String[] a) {
(new JDialog()).show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You need to add code to each dialog that handles the ESC key.