Package java.awt.font

Examples of java.awt.font.TextLayout.hitTestChar()


        }
        //System.out.println("Testing point: "+(x+tx)+",; "+y);
        //System.out.println("    in layout "+layout.getBounds());
        //System.out.println("    with advance: "+layout.getAdvance());
        TextHitInfo textHit =
            layout.hitTestChar((float) (x+tx), (float) y, layout.getBounds());
        //if (textHit != null) System.out.println("HIT : "+textHit);
        return new BasicTextPainter.Mark(x, y, layout, textHit);
    }

    /**
 
View Full Code Here


            // vector when the view is created so we don't need to rebuild it
            // every time
            int offset;
            if (text.length() > 0) {
                TextLayout textLayout = new TextLayout(text, font, fontRenderContext);
                TextHitInfo textHitInfo = textLayout.hitTestChar(x, y);
                offset = textHitInfo.getInsertionIndex();
            } else {
                offset = -1;
            }
View Full Code Here

        return text;
    }

    protected int getInsertionIndex(String text, int x) {
        TextLayout textLayout = new TextLayout(text, font, fontRenderContext);
        TextHitInfo textHitInfo = textLayout.hitTestChar(x + scrollLeft - padding.left - 1, 0);
        int index = textHitInfo.getInsertionIndex();

        return index;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.