8025126: [macosx] Invalid calls to setValueAt() within JTable in Java 7 on Mac OS X
Reviewed-by: serb
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Thu Nov 14 11:42:46 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Fri Nov 15 14:05:49 2013 +0400
@@ -949,7 +949,8 @@
KeyEvent keyEvent = new KeyEvent(focusOwner, id, when, modifiers,
keyCode, keyChar, keyLocation);
AWTAccessor.getKeyEventAccessor().setExtendedKeyCode(keyEvent,
- ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
+ (keyChar == KeyEvent.CHAR_UNDEFINED) ? keyCode
+ : ExtendedKeyCodes.getExtendedKeyCodeForChar(keyChar));
postEvent(keyEvent);
}
--- a/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java Thu Nov 14 11:42:46 2013 +0400
+++ b/jdk/test/java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java Fri Nov 15 14:05:49 2013 +0400
@@ -31,7 +31,7 @@
/*
* @test
- * @bug 8007156
+ * @bug 8007156 8025126
* @summary Extended key code is not set for a key event
* @author Alexandr Scherbatiy
* @run main ExtendedKeyCodeTest
@@ -44,6 +44,7 @@
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
Robot robot = new Robot();
+ robot.setAutoDelay(50);
Frame frame = new Frame();
frame.setSize(300, 300);
@@ -54,14 +55,14 @@
public void keyPressed(KeyEvent e) {
eventsCount++;
setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
- == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+ == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
}
@Override
public void keyReleased(KeyEvent e) {
eventsCount++;
setExtendedKeyCode = setExtendedKeyCode && (e.getExtendedKeyCode()
- == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
+ == ExtendedKeyCodes.getExtendedKeyCodeForChar(e.getKeyChar()));
}
});
@@ -77,5 +78,29 @@
if (eventsCount != 2 || !setExtendedKeyCode) {
throw new RuntimeException("Wrong extended key code");
}
+
+ frame = new Frame();
+ frame.setSize(300, 300);
+ setExtendedKeyCode = false;
+
+ frame.addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ setExtendedKeyCode = e.getExtendedKeyCode() == KeyEvent.VK_LEFT;
+ }
+ });
+
+ frame.setVisible(true);
+ toolkit.realSync();
+
+ robot.keyPress(KeyEvent.VK_LEFT);
+ robot.keyRelease(KeyEvent.VK_LEFT);
+ toolkit.realSync();
+ frame.dispose();
+
+ if (!setExtendedKeyCode) {
+ throw new RuntimeException("Wrong extended key code!");
+ }
}
}