🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9614

Re: JTextArea: How can i make this behave like a console/log viewer

#9614
From: John Zukowski
Date: Mon, 21 Feb 2000 00:00
30 lines
1439 bytes
Your probably better off using a JList (or JTable) instead.

Keep in mind that the text is stored in a Document, not in the JTextArea. You
can create a custom Document that when each line is added it chops one off from
the top when over the limit.

J

Kingsley wrote:

> im using a JTextArea to display text messages. im appending strings line by
> line.
>
> as the message grows beyond a certain limit (say 40 lines of text or beyond
> the viewing area) the messages at the top should get deleted and the new
> messages should be appended to the bottom.
>
> can any one give me possible solution or an idea !
>
> thanks for even just considering it! and THANKS for the solution in
> advance!!
>
> kingsley

--

John Zukowski
Get the jFAQs
http://www.jguru.com/jguru/faq/
Focus on Java @ http://java.about.com
Technical Details
Message-ID: <38B0E1DA.B3531019@jguru.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <87vdjn$cqt11@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,b57d3520469f3457
X-Google-Attributes: gid111d45,public
From: John Zukowski <jaz@jguru.com>
Subject: Re: JTextArea: How can i make this behave like a console/log viewer
Date: 2000/02/21
Message-ID: <38B0E1DA.B3531019@jguru.com>
X-Deja-AN: 587835861
Content-Transfer-Encoding: 7bit
References: <87vdjn$cqt11@bornews.borland.com>
To: Kingsley <kingsleys@hotmail.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: jGuru.com
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing