🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to change color of text selectively ?

#8458
From: John P. McGrath
Date: Thu, 24 Aug 2000 00:00
15 lines
1024 bytes
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: <MPG.140ea17c2ecf4b07989af8@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39A3E512.41163421@patni.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: John P. McGrath <JPMcGrath@fast.net>
Subject: Re: How to change color of text selectively ?
Date: 2000/08/24
Message-ID: <MPG.140ea17c2ecf4b07989af8@forums.borland.com>
X-Deja-AN: 661873700
References: <39A3E512.41163421@patni.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing