【发布时间】:2016-04-05 20:43:29
【问题描述】:
我想比较同一张表的 2 列中的日期。
我目前有以下代码打印来自JTable 的第 2 列和第 3 列的数据,但我需要做的是确定日期是否介于列的 2 个日期之间。我该怎么做?
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;
}
【问题讨论】:
标签: java swing date jtable comparison