Index: src/org/netbeans/core/windows/frames/NbFocusManager.java =================================================================== RCS file: /cvs/core/src/org/netbeans/core/windows/frames/NbFocusManager.java,v retrieving revision 1.20.2.3 diff -u -r1.20.2.3 NbFocusManager.java --- src/org/netbeans/core/windows/frames/NbFocusManager.java 16 Jan 2002 10:24:35 -0000 1.20.2.3 +++ src/org/netbeans/core/windows/frames/NbFocusManager.java 16 Jan 2002 13:48:23 -0000 @@ -96,6 +96,22 @@ KeyStroke key = KeyStroke.getKeyStrokeForEvent(anEvent); MenuSelectionManager selManager = MenuSelectionManager.defaultManager(); MenuElement[] elems = selManager.getSelectedPath(); + + // if menu popup is active and the user presses Escape we dismiss the + // popup and consume the event, otherwise pressing Escape on a popup + // displayed in a Dialog also dismisses the Dialog. + + if (elems != null + && elems.length > 0 + && !(elems[0].getComponent() instanceof ComboPopup) + && anEvent.getID() == KeyEvent.KEY_PRESSED + && anEvent.getModifiers() == 0 + && anEvent.getKeyCode() == KeyEvent.VK_ESCAPE + ) { + selManager.clearSelectedPath(); + anEvent.consume(); + return; + } if (! isTransmodalAction(key)) { Window w = SwingUtilities.windowForComponent(focusedComponent);