Lock/unlock auto scroll of JTextPane in JScrollPane ala eclipse console
From: Philippe (philmycupofjava_at_yahoo.fr)
Date: 02/24/04
- Next message: ak: "Re: Getting the Graphics context of an invisible component"
- Previous message: Axel Hallez: "Re: JasperReports, Itext, FOP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Feb 2004 03:15:23 -0800
Hello :-)
I have the following problem: I am developing an application that has
a text console in which debugging information is displayed.
I am using a JTextPane in a JScrollPane.
When the text size increases, the text pane scrolls vertically
automatically (altough this behavior seems to depend on the way I
append the text....)
For those who use the Eclipse environment, you're probably familiar
with this wonderful little button that allows you to lock/unlock the
automatic scrolling of the console window. I would like to do the
same, but using Swing, not SWT.
I have tried to listen to the text pane events: every time I append a
line of text, I receive a "resized" followed by a "moved" event. I
have tried to play with those listeners and the scrollRectToVisible
method but I still have many problems like flickering or a "bad lock"
(if the text is appended too fast, somehow I loose the lock so the
text pane scrolls up a bit then stops scrolling again)
Any idea, suggestion. Am I using the right methods ? or is there any
method I need to overload ?
Many thanks
Phil
- Next message: ak: "Re: Getting the Graphics context of an invisible component"
- Previous message: Axel Hallez: "Re: JasperReports, Itext, FOP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]