Click to See Complete Forum and Search --> : Chage the color of a row in JTABLE


February 29th, 2000, 12:16 PM
Hi,
Can anybody suggest me how can I change the row colors for the JTABLE rows ?
I have using AbstractTableModel to create my table.

Thanks in advance,

Niranjan

DHunter21
February 29th, 2000, 03:03 PM
If you just want to select or highlight some rows, you can use:

table.setRowSelectionInterval(indexa, indexb);

poochi
February 29th, 2000, 04:49 PM
You have to play with Cell Renderers ..

Check this post : http://codeguru.developer.com/bbs/wt/showpost.pl?Board=java&Number=5623&page=&view=&sb=

March 1st, 2000, 01:49 PM
Hey,
Your code works great ! Thanks...But I was trying to display a report with alternate rows having different color.
So if I associate the data element with color, it doesn't work properly..like if I have a city column in the report it will have the
same color for the city in all the places...irrespective of the rows.
I am using Vector to store the data and each element of the vector is a data-row ? Can you suggest something about this ?

Thanks in advance
Niranjan