List of usage examples for java.awt.font TextHitInfo getCharIndex
public int getCharIndex()
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 w w w.jav a2 s.com }); }