0

I was wondering if anyone could help me. I currently have a piece of code that connects to a SQL database and have successfully displayed it in a jtable with all the buttons etc. I will soon be needing to add an external table (plain text file) to the programme.

I was thinking is there a way to highlight (in a different colour) different rows in a table only if the is a common value between them i.e. a string or int?

For example you have table A & B, both containing rows and cells, but if a common value was known, such as a "name", then the row should be highlighted in either one or both tables.

Any help will be greatly appreciated.

kleopatra
  • 51,061
  • 28
  • 99
  • 211
weedywoo
  • 19
  • 2

1 Answers1

2

You can override prepareRenderer(), examine your TableModel, and set the color accordingly. See also this Q&A.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045