> I've been playing around with the JTable selection options and can't
> seem to get what I want.
[quoted text clipped - 4 lines]
> darker than the normal selection colour. Is there any way to get rid
> of this?
Use a custom renderer that does not paint the focus border. e.g.
TableCellRenderer nofocusRenderer = new DefaultTableCellRenderer()
{
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
{
return super.getTableCellRendererComponent(table,
value,
isSelected,
false,
row,
column);
}
}
> Is it possible to enable selection only for the cells within one
> column but to disable it for all the other columns?
If it is only for display purpose (i.e only one column to be shown with the
"selected" background/foreground), you could do it using a custom renderer.
(very similar to the above code : pass the "isSelected" parameter passed to the
super call only for the column for which you want the selection shown -
otherwise pass the value as "false"). Another option is to use a custom
ListSelectionModel to your tableColumnModel that allows selection of only one
column.
Note that if you use the renderer approach, the "column" parameter passed to you
is the column number in the view - not the model.
BK
Alexander Ames - 13 Sep 2004 23:04 GMT
>> I've been playing around with the JTable selection options and can't
>> seem to get what I want.
[quoted text clipped - 41 lines]
>
>BK
Thanks a lot!
K.H - 20 Oct 2004 10:26 GMT
Hi
I am a netbeans user. I have this problem.
I want through netbeans put a JSlider into a JTable cell.
I have read how to code it, but how do I do that through Netbeans?
I use netbeans 3.6 and 4.0 beta 2.