--- old/src/share/classes/java/awt/event/KeyEvent.java Mon Oct 29 18:49:03 2012 +++ new/src/share/classes/java/awt/event/KeyEvent.java Mon Oct 29 18:49:02 2012 @@ -930,6 +930,10 @@ long extendedKeyCode) { ev.extendedKeyCode = extendedKeyCode; } + + public Component getOriginalSource( KeyEvent ev ) { + return ev.originalSource; + } }); } @@ -939,6 +943,14 @@ */ private static native void initIDs(); + /** + * The original event source. + * + * Event source can be changed during processing, but in some cases + * we need to be 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); @@ -1023,6 +1035,7 @@ } else if ((getModifiers() == 0) && (getModifiersEx() != 0)) { setOldModifiers(); } + originalSource = source; } /**