I have a jtable that consists of columns:
C No, Borrower, Market, Loan, Start, Daily, Expiry
how can I highlight a table row if the current date is 5 days from the date inside the 'expiry' column?
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cal = Calendar.getInstance(); String expDateString = sdf.format(cal.getTime()).toString(); System.out.println(expDateString); String nana = tableSummary.getModel().getValueAt(row, 6).toString(); System.out.println(nana); for(int i=0; i<=tableSummary.getRowCount()-1; i++){ if(nana.compareTo(expDateString)>=0){ rowrenderer.setBackground(Color.RED); } }
java swing renderer jtable
zairahCS
source share