--- old/src/share/classes/java/awt/event/KeyEvent.java Fri Oct 26 21:01:40 2012 +++ new/src/share/classes/java/awt/event/KeyEvent.java Fri Oct 26 21:01:39 2012 @@ -930,6 +930,10 @@ long extendedKeyCode) { ev.extendedKeyCode = extendedKeyCode; } + + public Component getOriginalSource( KeyEvent ev ) { + return ev.originalSource; + } }); } @@ -939,10 +943,19 @@ */ private static native void initIDs(); + /** + * The original event source. + * + * Event source can be changed during processing, but in some cases + * we need to able to obtain original source. + */ + private Component originalSource; + private KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation, boolean isProxyActive) { this(source, id, when, modifiers, keyCode, keyChar, keyLocation); this.isProxyActive = isProxyActive; + originalSource = source; } /** @@ -1023,6 +1036,7 @@ } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) { setOldModifiers(); } + originalSource = source; } /** @@ -1069,6 +1083,7 @@ int keyCode, char keyChar) { this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN); + originalSource = source; } /** @@ -1078,6 +1093,7 @@ public KeyEvent(Component source, int id, long when, int modifiers, int keyCode) { this(source, id, when, modifiers, keyCode, (char)keyCode); + originalSource = source; } /**