< prev index next >

modules/graphics/src/main/java/com/sun/javafx/scene/text/TextLayout.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -73,10 +73,26 @@
     public static final int TYPE_STRIKETHROUGH  = 1 << 2;
     public static final int TYPE_BASELINE       = 1 << 3;
     public static final int TYPE_TOP            = 1 << 4;
     public static final int TYPE_BEARINGS       = 1 << 5;
 
+    public static class Hit {
+        int charIndex;
+        int insertionIndex;
+        boolean leading;
+
+        public Hit(int charIndex, int insertionIndex, boolean leading) {
+            this.charIndex = charIndex;
+            this.insertionIndex = insertionIndex;
+            this.leading = leading;
+        }
+
+        public int getCharIndex() { return charIndex; }
+        public int getInsertionIndex() { return insertionIndex; }
+        public boolean isLeading() { return leading; }
+    }
+
     /**
      * Sets the content for the TextLayout. Supports multiple spans (rich text).
      *
      * @return returns true is the call modifies the layout internal state.
      */

@@ -170,11 +186,12 @@
      * @param type the type of the shapes to include
      * @return the shape
      */
     public Shape getShape(int type, TextSpan filter);
 
-    public HitInfo getHitInfo(float x, float y);
+    public Hit getHitInfo(float x, float y);
+
     public PathElement[] getCaretShape(int offset, boolean isLeading,
                                        float x, float y);
     public PathElement[] getRange(int start, int end, int type,
                                   float x, float y);
 }
< prev index next >