equal
deleted
inserted
replaced
28 import java.awt.Component; |
28 import java.awt.Component; |
29 import java.awt.Container; |
29 import java.awt.Container; |
30 import java.awt.Event; |
30 import java.awt.Event; |
31 import java.awt.KeyEventPostProcessor; |
31 import java.awt.KeyEventPostProcessor; |
32 import java.awt.Window; |
32 import java.awt.Window; |
|
33 import java.awt.Toolkit; |
|
34 import sun.awt.SunToolkit; |
33 |
35 |
34 import java.awt.event.ActionEvent; |
36 import java.awt.event.ActionEvent; |
35 import java.awt.event.KeyEvent; |
37 import java.awt.event.KeyEvent; |
36 |
38 |
37 import javax.swing.AbstractAction; |
39 import javax.swing.AbstractAction; |
123 if(mbar == null && winAncestor instanceof JFrame) { |
125 if(mbar == null && winAncestor instanceof JFrame) { |
124 mbar = ((JFrame)winAncestor).getJMenuBar(); |
126 mbar = ((JFrame)winAncestor).getJMenuBar(); |
125 } |
127 } |
126 JMenu menu = mbar != null ? mbar.getMenu(0) : null; |
128 JMenu menu = mbar != null ? mbar.getMenu(0) : null; |
127 |
129 |
128 if (menu != null) { |
130 // It might happen that the altRelease event is processed |
|
131 // with a reasonable delay since it has been generated. |
|
132 // Here we check the last deactivation time of the containing |
|
133 // window. If this time appears to be greater than the altRelease |
|
134 // event time the event is skipped to avoid unexpected menu |
|
135 // activation. See 7121442. |
|
136 boolean skip = false; |
|
137 Toolkit tk = Toolkit.getDefaultToolkit(); |
|
138 if (tk instanceof SunToolkit) { |
|
139 skip = ev.getWhen() <= ((SunToolkit)tk).getWindowDeactivationTime(winAncestor); |
|
140 } |
|
141 |
|
142 if (menu != null && !skip) { |
129 MenuElement[] path = new MenuElement[2]; |
143 MenuElement[] path = new MenuElement[2]; |
130 path[0] = mbar; |
144 path[0] = mbar; |
131 path[1] = menu; |
145 path[1] = menu; |
132 msm.setSelectedPath(path); |
146 msm.setSelectedPath(path); |
133 } else if(!WindowsLookAndFeel.isMnemonicHidden()) { |
147 } else if(!WindowsLookAndFeel.isMnemonicHidden()) { |