Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2005

Tip: Looking for answers? Try searching our database.

How can I go to the first line of a JEditorPane programmatically?

Thread view: 
Ahmet Aksoy - 25 Mar 2005 11:27 GMT
Hi,
I have a JEditorPane.
It is filled up with appended lines programmatically.
When the total number of lines gets larger, the pane
starts scrolling, and it remains at the very last line.
But, I want the pane to show the first line.
So, how can I go to the first line using a method?
TIA
Ahmet Aksoy
SPG - 25 Mar 2005 12:58 GMT
Hi,

You can do this:

       pane.setCaretPosition(0);

which sets the cursor to the first element in your doc,  or

       pane.scrollRectToVisible(new Rectangle(0,0,1,1));

Have a play, see which works best for you..

Steve

> Hi,
> I have a JEditorPane.
[quoted text clipped - 5 lines]
> TIA
> Ahmet Aksoy
Ahmet Aksoy - 26 Mar 2005 09:11 GMT
Hi Steve,

setCaretPosition(0);
solved the problem. Thank you very much.

Ahmet Aksoy
> Hi,
>
[quoted text clipped - 19 lines]
> > TIA
> > Ahmet Aksoy


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.