🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Custom cell renderer for JList

#7964
From: Sam
Date: Thu, 16 Nov 2000 00:00
25 lines
1257 bytes
Aha.  Thanks for that.
Sam

Tor Iver Wilhelmsen wrote:
> 
> Sam <ssac@home.com> writes:
> 
> > I have created a custom cell renderer class according to examples I've
> > found in various places, but whenever I change a font/color of one item
> > of the list the entire list changes.
> 
> You need to set it _whenever_ you get the renderer: That is, instead of
> 
>   if (someCondition)
>      setFont(someBoldFont);
> 
> you need
> 
>   if (someCondition)
>      setFont(someBoldFont);
>   else
>      setFont(aPlainFont);
> 
> because the exact same component is returned, and if you change it
> once, it remains changed on the next request.
Technical Details
Message-ID: <3A142749.3D5DA769@home.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3A12D00B.A1FC637C@home.com> <ubsvguku2.fsf@sds.no>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,87dde9ec7baa975e
X-Google-Attributes: gid111d45,public
From: Sam <ssac@home.com>
Subject: Re: Custom cell renderer for JList
Date: 2000/11/16
Message-ID: <3A142749.3D5DA769@home.com>
X-Deja-AN: 694418871
Content-Transfer-Encoding: 7bit
References: <3A12D00B.A1FC637C@home.com> <ubsvguku2.fsf@sds.no>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: 16 Nov 2000 10:28:28 -0800, 24.113.3.107
Organization: @Home Network
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing