- public boolean onKeyDownPreview(char key, int modifiers) {\r
- // Use the popup's key preview hooks to close the dialog when either\r
- // enter or escape is pressed.\r
- switch (key) {\r
- case KeyboardListener.KEY_ENTER:\r
- accept();\r
- case KeyboardListener.KEY_ESCAPE:\r
- closeDialog();\r
- break;\r
- }\r
-\r
- return true;\r
- }\r
+ protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
+ super.onPreviewNativeEvent(preview);\r
+\r
+ NativeEvent evt = preview.getNativeEvent();\r
+ if (evt.getType().equals("keydown"))\r
+ // Use the popup's key preview hooks to close the dialog when either\r
+ // enter or escape is pressed.\r
+ switch (evt.getKeyCode()) {\r
+ case KeyCodes.KEY_ENTER:\r
+ accept();\r
+ case KeyCodes.KEY_ESCAPE:\r
+ closeDialog();\r
+ break;\r
+ }\r
+ }\r
+\r