0

I designed a JTable with Netbeans Builder and I created 5 columns, the 5th one is Boolean so I want to know how to highlight whole the row when the user selected.

enter image description here

nachokk
  • 14,363
  • 4
  • 24
  • 53

1 Answers1

0

See Table Row Rendering for an easy way to color an entire row based on a value in the row.

The problem now is that only the cell is automatically repainted when you click on the checkbox so you will also need to add a TableModelListener to the TableModel so you can invoke a repaint() on the table row whenever the state of the checkbox is changed.

camickr
  • 321,443
  • 19
  • 166
  • 288
  • Nimbus L&F has an repainting issue with Boolen.Class, this is standard output without reseting renderer to default, – mKorbel Dec 30 '13 at 20:06
  • actually I tried before but I got many errors.show me in simple example by using Netbean Builder. – loving java Dec 30 '13 at 20:08
  • [partial answer for Nimbus L&F](http://stackoverflow.com/a/13012508/714968) by @kleopatra, but I think that setOpaque for Boolean class to sovle any issue – mKorbel Dec 30 '13 at 20:10
  • @user3104849, `show me in simple example by using Netbean Builder.` - I gave you a simple example. I don't use an IDE to generate code for me. I write the code myself so I understand how the code works. I would rather spend time learning Swing then learning how to use an IDE. – camickr Dec 30 '13 at 20:56