changeset 4054:ee40f037a5e4

Fix RT-31266: VK - Remove use of reflection to create key events
author Seeon Birger <seeon.birger@oracle.com>
date Tue, 25 Jun 2013 14:43:56 +0300
parents 89c0cdee3771
children 0e0747873240
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java
diffstat 1 files changed, 2 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Mon Jun 24 23:05:10 2013 -0400
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/FXVKSkin.java	Tue Jun 25 14:43:56 2013 +0300
@@ -61,8 +61,6 @@
 import javafx.stage.Popup;
 import javafx.util.Duration;
 import com.sun.javafx.css.StyleManager;
-import com.sun.javafx.robot.impl.FXRobotHelper;
-import com.sun.javafx.robot.impl.FXRobotHelper.FXRobotInputAccessor;
 import com.sun.javafx.scene.control.behavior.BehaviorBase;
 
 import static javafx.scene.input.MouseEvent.*;
@@ -577,18 +575,7 @@
         }
 
         protected KeyEvent event(EventType<KeyEvent> type) {
-            try {
-                Field fld = FXRobotHelper.class.getDeclaredField("inputAccessor");
-                fld.setAccessible(true);
-                FXRobotInputAccessor inputAccessor = (FXRobotInputAccessor)fld.get(null);
-
-                return inputAccessor.createKeyEvent(type, KeyCode.UNDEFINED, chars, "",
-                                      shiftDown, false, false, false);
-            } catch (Exception e) {
-                System.err.println(e);
-            }
-
-            return null;
+            return new KeyEvent(type, chars, "", KeyCode.UNDEFINED, shiftDown, false, false, false); 
         }
     }
 
@@ -675,17 +662,7 @@
 
         protected KeyEvent event(EventType<KeyEvent> type) {
             if (type == KeyEvent.KEY_PRESSED || type == KeyEvent.KEY_RELEASED) {
-                try {
-                    Field fld = FXRobotHelper.class.getDeclaredField("inputAccessor");
-                    fld.setAccessible(true);
-                    FXRobotInputAccessor inputAccessor = (FXRobotInputAccessor)fld.get(null);
-
-                    return inputAccessor.createKeyEvent(type, code, chars, chars,
-                                          shiftDown, false, false, false);
-                } catch (Exception e) {
-                    System.err.println(e);
-                }
-                return null;
+                return new KeyEvent(type, chars, chars, code, shiftDown, false, false, false);                                          
             } else {
                 return super.event(type);
             }