🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Custom cell renderer for JList

#7962
From: Tor Iver Wilhelmsen
Date: Thu, 16 Nov 2000 00:00
20 lines
1027 bytes
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: <ubsvguku2.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3A12D00B.A1FC637C@home.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,87dde9ec7baa975e
X-Google-Attributes: gid111d45,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: Custom cell renderer for JList
Date: 2000/11/16
Message-ID: <ubsvguku2.fsf@sds.no>
X-Deja-AN: 694309373
Sender: towi@SDSA1761
References: <3A12D00B.A1FC637C@home.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing