🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to change color of text selectively ?

#8461
From: Vikas Chauhan
Date: Thu, 24 Aug 2000 00:00
23 lines
1381 bytes
thanx John ,
    I fixed it . used the StyleConstants class and the Mutable
AttributeSet... works like a charm
thanx
vikas

"John P. McGrath" wrote:

> On Wed, 23 Aug 2000 15:52:02 +0100, Vikas Chauhan wrote:
>
> > I wish to change the color of a keyword the moment it is typed in the
> > JTextArea . I have made my  own document class extending PlainDocument
> > and I am successfully able to trap the event that my keyword has been
> > typed . But ...but... how do i change the color of that particular word
> > ? I did not find any way to selectively change the text color.
>
> PlainDocument will only do a single color text.  Take a look at the
> DefaultStyledDocument class.
>
> --
> Regards,
>
> John McGrath
Technical Details
Message-ID: <39A525C7.D1C533DA@patni.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39A3E512.41163421@patni.com> <MPG.140ea17c2ecf4b07989af8@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,4cb68b7390a5ec27
X-Google-Attributes: gid111d45,public
From: Vikas Chauhan <vikas.chauhan@patni.com>
Subject: Re: How to change color of text selectively ?
Date: 2000/08/24
Message-ID: <39A525C7.D1C533DA@patni.com>
X-Deja-AN: 661878492
Content-Transfer-Encoding: 7bit
References: <39A3E512.41163421@patni.com> <MPG.140ea17c2ecf4b07989af8@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: 24 Aug 2000 01:58:30 -0800, 199.92.207.56
Organization: PCS Ltd.
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing