Hi all, I have a question regarding use of
the Swing JTextArea component. I have a simple
utility that monitors a JMS queue and displays
some output when certain messages arrive.  Currently
I just call JTextArea.append() every time a new
message arrives, and forget it.

However, I am concerned that this approach will
cause the memory usage of my application
to grow until it dies with an OutOfMemoryError.

So, I'm wondering: is this what is going to happen
if I just keep appending to the JTextArea, and never
take any steps to "throw away" old data? And if so,
how do I get rid of the "old stuff" in the JTextArea?

I'm guessing I'd do something like register a DocumentListener,
and in that listener keep track of how much data had been
appended, and then start throwing stuff away at a certain point,
by calling Document.remove().  Does that sound anything like
correct?


Thanks,

Phillip
--
Vote Badnarik for President 2004
www.badnarik.org

FREE AMERICA
Vote Libertarian
www.lp.org

_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to