finding out the cursor location in JTextPane
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jeffrey_Kwok
Posted On:   Wednesday, August 15, 2001 12:53 AM

i have a problem of finding out the cursor location in JTextPane, can anybody help me? coz it is urgent


Please use html tags to format code blocks.

Re: finding out the cursor location in JTextPane

Posted By:   prakash_kumar  
Posted On:   Thursday, August 16, 2001 05:05 AM

If u want to get the caret position JTextPane has a method called
getCaretPosition().
If u want to get the mouse pointer position where u clicked
you can use the following code in mouse pressed event
Point pt = e.getPoint();
int caretposition = this.viewToModel(pt);
About | Sitemap | Contact