🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTextArea

#9660
From: Kingsley
Date: Fri, 11 Feb 2000 00:00
44 lines
2257 bytes
thanks

u r correct im trying to keep the storage requirements from growing too
large. as the number of lines grow larger the activity seems to slow down
drasticaly.

do you know any other component which can behave like a console?

kingsley

John P. McGrath <JPMcGrath@fast.net> wrote in message
news:MPG.130d587df87f2e0b989784@forums.borland.com...
> On Thu, 10 Feb 2000 17:37:16 -0500, 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 !
>
> One approach would be to get the Document for the JTextArea, add a
> DocumentListener to it, and then remove text when you get an event with
> eventType == INSERT.
>
> Another approach would be to subclass JTextArea, override the append()
> method (I assume that is what you are using) and automatically remove
> text when text is added.
>
> Another would be to create your own Document class that holds a fixed
> number of lines of text.  This would best be accomplished by subclassing
> AbstractDocument or PlainDocument.
>
> I am not sure which would be best for you.  It would probably depend at
> least partially on whether you really need an exact number of lines, or
> just want to keep the storage requirements from growing too large.
>
> --
> John P. McGrath
> <JPMcGrath@fast.net>
> <jpm@nscs.fast.net>
Technical Details
Message-ID: <8818fu$e3111@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <86960s$ibp7@bornews.borland.com> <87vdpo$cr018@bornews.borland.com> <MPG.130d587df87f2e0b989784@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,569c179d91546360
X-Google-Attributes: gid111d45,public
From: "Kingsley" <kingsleys@hotmail.com>
Subject: Re: JTextArea
Date: 2000/02/11
Message-ID: <8818fu$e3111@bornews.borland.com>
X-Deja-AN: 584575676
References: <86960s$ibp7@bornews.borland.com> <87vdpo$cr018@bornews.borland.com> <MPG.130d587df87f2e0b989784@forums.borland.com>
X-Priority: 3
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: McGraw-Hill
X-MSMail-Priority: Normal
Reply-To: "Kingsley" <kingsleys@hotmail.com>
Newsgroups: borland.public.jbuilder.java.swing