Hi Friends,
I am displaying an HTML file's contents in a JEditorPane. I want that,
whenever that file is opened, the cursor should be on a particular
position. How it can be done?? Pls tell ASAP.
Thanks in advance
Andrew Thompson - 21 Nov 2007 10:45 GMT
...
>...Pls tell ASAP.
If you don't get an answer within half an hour, it's 'free'.

Signature
Andrew Thompson
http://www.physci.org/
Manish Pandit - 21 Nov 2007 18:55 GMT
> Hi Friends,
> I am displaying an HTML file's contents in a JEditorPane. I want that,
> whenever that file is opened, the cursor should be on a particular
> position. How it can be done?? Pls tell ASAP.
>
> Thanks in advance
Here is the javadoc:
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/JTextComponent.html#set
CaretPosition(int)
The method is setCaretPosition( ). However, be careful to give it a
value between zero and the size of the text.
-cheers,
Manish
Roedy Green - 21 Nov 2007 23:15 GMT
On Wed, 21 Nov 2007 01:47:38 -0800 (PST), manu
<manu.maheshwari@gmail.com> wrote, quoted or indirectly quoted someone
who said :
>I am displaying an HTML file's contents in a JEditorPane. I want that,
>whenever that file is opened, the cursor should be on a particular
>position. How it can be done?? Pls tell ASAP.
Here are two hints.
1. When you can't find the method you want in the class, look in the
superclasses.
2. the "cursor" is the thing that tracks the mouse. The "caret" in the
thing that tracks the insertion point in a block of text.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green - 21 Nov 2007 23:25 GMT
On Wed, 21 Nov 2007 01:47:38 -0800 (PST), manu
<manu.maheshwari@gmail.com> wrote, quoted or indirectly quoted someone
who said :
>the cursor should be on a particular
>position.
see http://mindprod.com/jgloss/cursor.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com