Hello,
I have been trying to solve this problem but could not so far. So
hopefully someone could give me the direction.
I created an HTML viewer that view html documents on the pane
(created by JScrollPane/JEditorPane). What I want is if user scroll the
scrollbar up and down, it will remain at that position when the content of
the html file is changed and the view is refresh to reload the new
content, and here is the problem:
- If I load all the content of the file to a string, change and
reload it by setText(String) method, things are going fine at the first
time, but after that the horizontal scrollbar always get down to the
bottom of the view, and I couldn't set it to any other position.
- If I set the view directly from the file by using the
setPage("file:filename") method. It would be done at the first time, and I
could control the horizontal scrollbar, but the new content of the file
wasn't reload. If I set this statement before using setPage method:
pane.getDocument().putProperty(Document.StreamDescriptionProperty,null);
then the new content will be re-load when using setPage, but again, I
could not control the position of the scrollbar.
The way I control the scrollbar is this:
Before calling the funtion to create the new content of the html document,
I get the current position by :
objPoint = pane.getViewport().getViewPosition();
and after loading by using setText/setPage, I call
pane.getViewport().setViewPosition(objPoint);
Many thanks in advance if anyone could give me your suggestion, I have
been working around with it for quite a while but could not solve.
Binh.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html