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.

View | Details | Raw Unified | Return to bug 17548
Collapse All | Expand All

(-)org/netbeans/core/windows/frames/ShortcutAndMenuKeyEventProcessor.java (-3 / +23 lines)
Lines 47-52 Link Here
47
        keyboardFocusManager.addKeyEventPostProcessor(this);
47
        keyboardFocusManager.addKeyEventPostProcessor(this);
48
    }
48
    }
49
    
49
    
50
51
    private KeyEvent lastKeyPressed; // which posted a popup from main menu
52
    
50
    public boolean postProcessKeyEvent(KeyEvent ev) {
53
    public boolean postProcessKeyEvent(KeyEvent ev) {
51
        if (ev.isConsumed())
54
        if (ev.isConsumed())
52
            return false;
55
            return false;
Lines 85-92 Link Here
85
            return false;
88
            return false;
86
        boolean pressed = (ev.getID() == KeyEvent.KEY_PRESSED);
89
        boolean pressed = (ev.getID() == KeyEvent.KEY_PRESSED);
87
90
88
        invokeProcessKeyBindingsForAllComponents(ev, mw, pressed);
91
        boolean res = invokeProcessKeyBindingsForAllComponents(ev, mw, pressed);
89
        return false;
92
        if (res) {
93
            ev.consume();
94
            lastKeyPressed = ev;
95
        }
96
        else {
97
            lastKeyPressed = null;
98
        }
99
        return res;
90
    }
100
    }
91
101
92
    public boolean dispatchKeyEvent(KeyEvent ev) {
102
    public boolean dispatchKeyEvent(KeyEvent ev) {
Lines 105-110 Link Here
105
        if (arr == null || arr.length == 0)
115
        if (arr == null || arr.length == 0)
106
            return false;
116
            return false;
107
117
118
        if (lastKeyPressed != null
119
            && ev.getID() == KeyEvent.KEY_TYPED
120
            && lastKeyPressed.getModifiers() == InputEvent.ALT_MASK
121
            && ev.getModifiers() == InputEvent.ALT_MASK
122
            && lastKeyPressed.getKeyChar() == ev.getKeyChar()
123
            ) {
124
            ev.consume();
125
            return true;
126
        }
127
        
108
        MenuSelectionManager.defaultManager().processKeyEvent(ev);
128
        MenuSelectionManager.defaultManager().processKeyEvent(ev);
109
        
129
        
110
        if (!ev.isConsumed() && arr[0] instanceof JMenuBar) {
130
        if (!ev.isConsumed() && arr[0] instanceof JMenuBar) {
Lines 132-138 Link Here
132
        
152
        
133
        return false;
153
        return false;
134
    }
154
    }
135
    
155
136
    /**
156
    /**
137
     * Checks to see if a given keystroke is bound to an action which should
157
     * Checks to see if a given keystroke is bound to an action which should
138
     * function on all focused components.  This includes the Main Window,
158
     * function on all focused components.  This includes the Main Window,

Return to bug 17548