Example usage for java.awt.font TextHitInfo getInsertionIndex

List of usage examples for java.awt.font TextHitInfo getInsertionIndex

Introduction

In this page you can find the example usage for java.awt.font TextHitInfo getInsertionIndex.

Prototype

public int getInsertionIndex() 

Source Link

Document

Returns the insertion index.

Usage

From source file:MainClass.java

public MyCanvas() {
    addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent me) {
            TextHitInfo hit = mTextLayout.hitTestChar(me.getX() - mX, me.getY() - mY);
            System.out.println(hit.getCharIndex());
            System.out.println(hit.getInsertionIndex());
            System.out.println(hit.isLeadingEdge());
        }/*from ww w .  j  a v  a  2 s.  c  om*/
    });

}