JDK-6363026 : Mnemonics don't consume proper events
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,windows_xp
  • CPU: x86
  • Submitted: 2005-12-14
  • Updated: 2011-01-19
  • Resolved: 2006-02-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b71Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
althoug 6346690 (Mnemonics don't consume proper events)
was fixed in mustang beta, it is still reproducible in rc.

Comments
SUGGESTED FIX ------- BasicPopupMenuUI.java ------- *** /tmp/sccs.Ibaq71 Thu Dec 15 17:37:42 2005 --- BasicPopupMenuUI.java Thu Dec 15 17:34:47 2005 *************** *** 331,340 **** --- 331,341 ---- // we have a menu item manager.clearSelectedPath(); item.doClick(); } e.consume(); + sun.awt.SunToolkit.consumeNextKeyTyped(e); } else { // Select the menu item with the matching mnemonic. If // the same mnemonic has been invoked then select the next // menu item in the cycle. MenuElement newItem = null; ------- DefaultKeyboardFocusManager.java ------- *** /tmp/sccs.uZaWW1 Thu Dec 15 17:37:41 2005 --- DefaultKeyboardFocusManager.java Thu Dec 15 17:34:47 2005 *************** *** 950,959 **** --- 950,967 ---- } } return dispatchKeyEvent(ke); } + /* + * @param e is a KEY_PRESSED event that can be used + * to track the next KEY_TYPED related. + */ + private void consumeNextKeyTyped(KeyEvent e) { + consumeNextKeyTyped = true; + } + private void consumeTraversalKey(KeyEvent e) { e.consume(); consumeNextKeyTyped = (e.getID() == KeyEvent.KEY_PRESSED) && !e.isActionKey(); } ------- SunToolkit.java ------- *** /tmp/sccs.unaqd2 Thu Dec 15 17:37:43 2005 --- SunToolkit.java Thu Dec 15 17:34:47 2005 *************** *** 11,20 **** --- 11,21 ---- import static java.awt.RenderingHints.*; import java.awt.dnd.*; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.peer.*; import java.awt.event.WindowEvent; + import java.awt.event.KeyEvent; import java.awt.im.spi.InputMethodDescriptor; import java.awt.image.*; import java.awt.geom.AffineTransform; import java.awt.TrayIcon; import java.awt.SystemTray; *************** *** 1629,1638 **** --- 1630,1656 ---- } } public abstract boolean isDesktopSupported(); + + private static Method consumeNextKeyTypedMethod = null; + public static synchronized void consumeNextKeyTyped(KeyEvent keyEvent) { + if (consumeNextKeyTypedMethod == null) { + consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class, + "consumeNextKeyTyped", + new Class[] {KeyEvent.class}); + } + try { + consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(), + keyEvent); + } catch (IllegalAccessException iae) { + iae.printStackTrace(); + } catch (InvocationTargetException ite) { + ite.printStackTrace(); + } + } } // class SunToolkit /* * PostEventQueue is a Thread that runs in the same AppContext as the
23-12-2005

EVALUATION <<I'll also mention that I see this bug on my windows box too. When running NB 5.0 with latest mustang builds if I hit 'Alt-f s' (to save) sometimes the s ends up in the editor. VERY annoying!>> -- by ###@###.###
15-12-2005

EVALUATION need to be resolved in mustang rc
14-12-2005