• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

set rows color in JTable

 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I require to set the color of a row based on the value present in it. Suppose there are 3 columns col1,col2,col3 respectively and there are 2 rows as 1,2,3 and row 2 is 4,5,6
Now i need to set the color of the row to red when it contains the value 2. How can i do that some one help.


Thanks and Regards
alexander
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using your own table model? If so, you should able to determine the data of the table cell and do the checking accordingly.
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I am using DefaultTableModel
 
Maneesh Godbole
Saloon Keeper
Posts: 11164
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried following that tutorial but i am using default table model to get data from data base. The code is below some one please point out what changes shall i do.






Thanks in Advance
alexander>
 
adeeb alexander
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guyz i have done it like this. If any more ideas please give me.

>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic