Home arrow static arrow Java Programming [Archive] - JEditorPane caret following mouse
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - JEditorPane caret following mouse
This topic has 2 replies on 1 page.

Posts:47
Registered: 5/1/02
JEditorPane caret following mouse  
Jul 20, 2004 7:38 PM



 
How, if possible, can i get the Caret to follow the mouse??

so in the sentence above, if the mouse is over the word "Caret" the cursor/caret would be in the respective location.
 

Posts:24,517
Registered: 98-02-27
Re: JEditorPane caret following mouse  
Jul 20, 2004 8:11 PM (reply 1 of 2)



 
[url http://java.sun.com/docs/books/tutorial/uiswing/events/mousemotionlistener.html]How to Write a Mouse Motion Listener[/url]

int offset = textComponent.viewToModel(mouseEvent.getPoint());
textComponent.setCaretPosition(offset);
 

Posts:47
Registered: 5/1/02
Re: JEditorPane caret following mouse  
Jul 20, 2004 8:58 PM (reply 2 of 2)



 
wow...i feel like a jack ***
but thx very much
 
This topic has 2 replies on 1 page.