1
我想比較同一表的2列中的日期。比較JTable中的2列日期
我目前有以下代碼,它打印JTable
第2列和第3列中的數據,但我需要做的是確定日期是否在列的兩個日期之間。我將如何做到這一點?
public Object[][] betweendates (JTable table) {
String tab ="\t";
String newLine ="\n";
TableModel dtm = table.getModel();
int nRow = dtm.getRowCount(), nCol = dtm.getColumnCount();
Object[][] tableData = new Object[nRow][nCol];
for (int i = 0 ; i < nRow ; i++)
{
for (int j = 2 ; j <= 3 ; j++)
{
tableData[i][j] = dtm.getValueAt(i,j);
System.out.print(tableData[i][j]);
comparedates(tableData[i][j]);
System.out.print("\t");
}
System.out.println();//create a new line
}
return tableData;
}
我要把這一個去 – Ingram
還要考慮'RowFilter',看到[這裏](http://stackoverflow.com/q/17854854/230513)。 – trashgod