This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
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);