< prev index next >

modules/controls/src/main/java/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java

Print this page

        

@@ -40,16 +40,16 @@
 import javafx.scene.control.skin.TextFieldSkin;
 import com.sun.javafx.scene.control.skin.Utils;
 import javafx.scene.input.ContextMenuEvent;
 import javafx.scene.input.KeyEvent;
 import javafx.scene.input.MouseEvent;
+import javafx.scene.text.HitInfo;
 import javafx.stage.Screen;
 import javafx.stage.Window;
 import com.sun.javafx.PlatformUtil;
 import com.sun.javafx.geom.transform.Affine3D;
 
-import static javafx.scene.control.skin.TextFieldSkin.TextPosInfo;
 import static com.sun.javafx.PlatformUtil.isMac;
 import static com.sun.javafx.PlatformUtil.isWindows;
 
 /**
  * Text field behavior.

@@ -255,13 +255,12 @@
             // only if there is no selection should we see the caret
 //            setCaretOpacity(if (textInputControl.dot == textInputControl.mark) then 1.0 else 0.0);
 
             // if the primary button was pressed
             if (e.isPrimaryButtonDown() && !(e.isMiddleButtonDown() || e.isSecondaryButtonDown())) {
-                TextPosInfo hit = skin.getIndex(e.getX(), e.getY());
-                String text = textField.textProperty().getValueSafe();
-                int i = Utils.getHitInsertionIndex(hit, text);
+                HitInfo hit = skin.getIndex(e.getX(), e.getY());
+                int i = hit.getInsertionIndex();
                 final int anchor = textField.getAnchor();
                 final int caretPosition = textField.getCaretPosition();
                 if (e.getClickCount() < 2 &&
                     (Properties.IS_TOUCH_SUPPORTED ||
                      (anchor != caretPosition &&

@@ -395,25 +394,25 @@
         }
 
         e.consume();
     }
 
-    protected void mouseSingleClick(TextPosInfo hit) {
+    protected void mouseSingleClick(HitInfo hit) {
         skin.positionCaret(hit, false);
     }
 
-    protected void mouseDoubleClick(TextPosInfo hit) {
+    protected void mouseDoubleClick(HitInfo hit) {
         final TextField textField = getNode();
         textField.previousWord();
         if (isWindows()) {
             textField.selectNextWord();
         } else {
             textField.selectEndOfNextWord();
         }
     }
 
-    protected void mouseTripleClick(TextPosInfo hit) {
+    protected void mouseTripleClick(HitInfo hit) {
         getNode().selectAll();
     }
 
     // Enumeration of all types of text input that can be simulated on
     // touch device, such as iPad. Type is passed to native code and
< prev index next >