🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to color a cell in a jTable

#8847
From: Ian Atkinson
Date: Mon, 03 Jul 2000 00:00
21 lines
1267 bytes
hello -

if you create a table cell renderer and a assign this to your column
using column.setCellRenderer().

in your renderer, you can override the getTableCellRendererComponent and
set up the renderer as you wish.

public Component getTableCellRendererComponent(JTable table, Object
value, boolean isSelected, boolean hasFocus, int row, int column)
{
	if(row == 3 && col == 3)
	{
		this.setColor(Color.RED);
	}
}


i am doing something similare for drawing custom icons in a table

ian
Technical Details
Message-ID: <3960C4C6.7B614DA5@labs.mot.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <395DF8B2.524620C@stud.fh-regensburg.de> <962640227.26351.0.nnrp-02.c29f1f7c@news.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,55df0e2e89142c79
X-Google-Attributes: gid111d45,public
From: Ian Atkinson <atkinson@labs.mot.com>
Subject: Re: How to color a cell in a jTable
Date: 2000/07/03
Message-ID: <3960C4C6.7B614DA5@labs.mot.com>
X-Deja-AN: 641897951
Content-Transfer-Encoding: 7bit
References: <395DF8B2.524620C@stud.fh-regensburg.de> <962640227.26351.0.nnrp-02.c29f1f7c@news.demon.co.uk>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: postmaster@mot.com
X-Trace: schbbs.mot.com 962642920 19735 182.1.83.2 (3 Jul 2000 16:48:40 GMT)
Organization: Motorola
Mime-Version: 1.0
NNTP-Posting-Date: 3 Jul 2000 16:48:40 GMT
Newsgroups: borland.public.jbuilder.java.swing