Article View: borland.public.jbuilder.java.swing
Article #9496selected cell is not showed in a JTable
From: Fam. Moreno-Lehmann
Date: Tue, 28 Mar 2000 00:00
Date: Tue, 28 Mar 2000 00:00
30 lines
1597 bytes
1597 bytes
I have a labelCellRender for a JTable, because I want to display an
imageIcon depending on something. Everything works fine except that when
I select the cell, the selectionColor does not show, so you can�t see
which cell is being selected.
The code of the labelCellRender is as follows:
class labelCellRenderer extends JLabel implements TableCellRenderer {
public labelCellRenderer() {
super();
}
public Component getTableCellRendererComponent(JTable table,
Object value, boolean
isSelected,
boolean hasFocus,
int row, int column){
if(value==null) { return this;}
if(value instanceof Detail) {
Detail detail = (Detail)value;
int level = detail.getLevel();
String description = detail.getDescription();
setText(description);
this.setIcon(image[level]);}
}
}
what�s wrong? Could any body help me?
Thanks
Hilde Lehmann
Technical Details
Message-ID:
<38E1368C.A8C514BC@intercable.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 111d45,e9e741b43927d24a,start X-Google-Attributes: gid111d45,public From: "Fam. Moreno-Lehmann" <mole@intercable.net> Subject: selected cell is not showed in a JTable Date: 2000/03/28 Message-ID: <38E1368C.A8C514BC@intercable.net> X-Deja-AN: 603618365 Content-Transfer-Encoding: 8bit X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Trace: 28 Mar 2000 14:36:22 -0800, 207.248.41.120 MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing