Forums Register Login

Different bg colors for JTable alternate rows - urgent

+Pie Number of slices to send: Send
Hi All,
Could any body help with code snippet for rendering the alternate rows background with different colors using Jtable, for eg.,
row 1 bgcolor - red
row 2 bgcolor - green
row 3 bgcolor - red
row 4 bgcolor - green and so on...
Thanx,
Ever Yours,
sakthi.
+Pie Number of slices to send: Send
Create your own cell renderer. Extend DefaultTableCellRenderer and override the getTableCellRendererComponent() method. Check what row the cell is in and set the background color to what you want.
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1310 times.
Similar Threads
Background Pattern for a Cell in JTable
JTable
Images in a JTable
JTable Color Change
JTable row coloring
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:11:50.