8025126: [macosx] Invalid calls to setValueAt() within JTable in Java 7 on Mac OS X

Reviewed-by: serb
This commit is contained in:
Alexander Scherbatiy 2013-11-15 14:05:49 +04:00
parent 5f7b6dfb6c
commit e04c087c6d
2 changed files with 30 additions and 4 deletions

View File

@ -949,7 +949,8 @@ public class LWWindowPeer
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);
}

View File

@ -31,7 +31,7 @@ import sun.awt.SunToolkit;
/*
* @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 class ExtendedKeyCodeTest {
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 class ExtendedKeyCodeTest {
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 @@ public class ExtendedKeyCodeTest {
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!");
}
}
}