-
Bug
-
Resolution: Fixed
-
P3
-
7u6, 7u40, 8
-
b01
-
b105
-
os_x
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8034609 | 7u65 | Leonid Romanov | P3 | Resolved | Fixed | b01 |
JDK-8023102 | 7u60 | Leonid Romanov | P3 | Closed | Fixed | b01 |
FULL PRODUCT VERSION :
java version " 1.7.0_40-ea "
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b38)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b55, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OSX 10.8.4
A DESCRIPTION OF THE PROBLEM :
I filed bug report 8020510, which was closed as NonReproducible because of fixes between 7u25 and 7u40. I've updated and confirmed that cmd-delete and some other keystrokes are no longer duplicated in 7u40, but there are at least two keystrokes that are still duplicated when the JFrame is present (not duplicated when the JFrame is close.)
Cmd-Enter (or Meta-enter)
and Control-Enter
I have not combed through every possible key. Since it seems like these are getting addressed piecemeal, that plus perhaps a unit test is justified:
first, http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8008366
second, http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8020510
and my report today shows there are still others.
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
- Bind one of the listed keys as the accelerator to a menu action.
- Type the key into the application.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A single event.
ACTUAL -
Two events.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.ActionEvent;
import javax.swing.*;
public class DemonstrateDuplicateKeys {
public static void main(String[] args) {
System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
JFrame frame = new JFrame();
JMenuBar jmb = new JMenuBar();
jmb.removeAll();
JMenu m = new JMenu( " Actions " );
for (final String keyname : new String[] { " A " ,
" DELETE " , " meta DELETE " , " shift DELETE " , " control DELETE " , " alt DELETE " ,
" BACK_SPACE " , " meta BACK_SPACE " , " control BACK_SPACE " , " shift BACK_SPACE " , " alt BACK_SPACE " ,
" ENTER " , " meta ENTER " , " shift ENTER " , " control ENTER " , " alt ENTER " ,
" typed = " , " meta typed = " , " shift typed = " , " control typed = " , " alt typed = " ,
" typed b " , " meta typed b " , " shift typed b " , " control typed b " , " alt typed b "
}) {
addMenuItem(m, KeyStroke.getKeyStroke(keyname), quickieAction(keyname));
}
m.addSeparator();
Action quitaction = new AbstractAction( " Quit " ) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println( " Quit " );
System.exit(0);
}
};
addMenuItem(m, KeyStroke.getKeyStroke('q'), quitaction);
final JFrame f1 = frame;
Action closeaction = new AbstractAction( " Close JFrame (Bug will disappear) " ) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println( " Closing window. Bug will disappear " );
f1.setVisible(false);
}
};
addMenuItem(m, KeyStroke.getKeyStroke('c'), closeaction);
// ?? when the jframe is dismissed, the DELETE bug goes away.
jmb.add(m);
frame.setJMenuBar(jmb);
frame.add(new JLabel( " Press some keys (see Action menu) " ));
frame.pack();
frame.setVisible(true);
System.out.println( " Ready " );
}
private static void addMenuItem(JMenu m, KeyStroke key, Action action) {
action.putValue(Action.ACCELERATOR_KEY, key);
m.add(action);
System.out.println( " added " + action.getValue(Action.NAME));
}
private static AbstractAction quickieAction(final String keyname) {
return new AbstractAction(keyname) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println(keyname);
}
};
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround.
java version " 1.7.0_40-ea "
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b38)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b55, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
OSX 10.8.4
A DESCRIPTION OF THE PROBLEM :
I filed bug report 8020510, which was closed as NonReproducible because of fixes between 7u25 and 7u40. I've updated and confirmed that cmd-delete and some other keystrokes are no longer duplicated in 7u40, but there are at least two keystrokes that are still duplicated when the JFrame is present (not duplicated when the JFrame is close.)
Cmd-Enter (or Meta-enter)
and Control-Enter
I have not combed through every possible key. Since it seems like these are getting addressed piecemeal, that plus perhaps a unit test is justified:
first, http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8008366
second, http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8020510
and my report today shows there are still others.
REGRESSION. Last worked in version 6u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
- Bind one of the listed keys as the accelerator to a menu action.
- Type the key into the application.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A single event.
ACTUAL -
Two events.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.ActionEvent;
import javax.swing.*;
public class DemonstrateDuplicateKeys {
public static void main(String[] args) {
System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
JFrame frame = new JFrame();
JMenuBar jmb = new JMenuBar();
jmb.removeAll();
JMenu m = new JMenu( " Actions " );
for (final String keyname : new String[] { " A " ,
" DELETE " , " meta DELETE " , " shift DELETE " , " control DELETE " , " alt DELETE " ,
" BACK_SPACE " , " meta BACK_SPACE " , " control BACK_SPACE " , " shift BACK_SPACE " , " alt BACK_SPACE " ,
" ENTER " , " meta ENTER " , " shift ENTER " , " control ENTER " , " alt ENTER " ,
" typed = " , " meta typed = " , " shift typed = " , " control typed = " , " alt typed = " ,
" typed b " , " meta typed b " , " shift typed b " , " control typed b " , " alt typed b "
}) {
addMenuItem(m, KeyStroke.getKeyStroke(keyname), quickieAction(keyname));
}
m.addSeparator();
Action quitaction = new AbstractAction( " Quit " ) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println( " Quit " );
System.exit(0);
}
};
addMenuItem(m, KeyStroke.getKeyStroke('q'), quitaction);
final JFrame f1 = frame;
Action closeaction = new AbstractAction( " Close JFrame (Bug will disappear) " ) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println( " Closing window. Bug will disappear " );
f1.setVisible(false);
}
};
addMenuItem(m, KeyStroke.getKeyStroke('c'), closeaction);
// ?? when the jframe is dismissed, the DELETE bug goes away.
jmb.add(m);
frame.setJMenuBar(jmb);
frame.add(new JLabel( " Press some keys (see Action menu) " ));
frame.pack();
frame.setVisible(true);
System.out.println( " Ready " );
}
private static void addMenuItem(JMenu m, KeyStroke key, Action action) {
action.putValue(Action.ACCELERATOR_KEY, key);
m.add(action);
System.out.println( " added " + action.getValue(Action.NAME));
}
private static AbstractAction quickieAction(final String keyname) {
return new AbstractAction(keyname) {
@Override public void actionPerformed(@SuppressWarnings( " unused " ) ActionEvent e) {
System.out.println(keyname);
}
};
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround.
- backported by
-
JDK-8034609 [macosx] Remaining duplicated key events
- Resolved
-
JDK-8023102 [macosx] Remaining duplicated key events
- Closed