2

Can anybody help me how can I highlight a table row when a condition is met? Here is my code, in this code i all of my table is highlighted, but i only need to highlight are the rows that equals to my set condition. I hope you guys can help me....

Thanks in advance.

public void show_table() {
    ArrayList<spareBoards> list = spareboardTable() ;
    DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
    Object[] row = new Object[5];
    for(int i = 0;i < list.size();i++) {
        row[0] = list.get(i).getsno();
        row[1] = list.get(i).getboardname();
        row[2] = list.get(i).getserialNumber();
        row[3] = list.get(i).getstatus();
        model.addRow(row);
        //to highlight the for 3rd verification board////

        if(row[3].equals("3rd Verification")){     
            jTable1.setBackground(Color.orange);
            }
    }                      
} 
Akshay
  • 1,161
  • 1
  • 12
  • 33
Justine
  • 21
  • 4

0 Answers0