我正在根据列的数据调整列的大小,如下所示:
/**
* Set the widths of the columns in the table according to the data in the table.
* @param table
*/
private static void setColumnWidths(JTable table)
{
int columnCount = table.getModel().getColumnCount();
int rowCount = table.getModel().getRowCount();
我有一个jTable,我用它来输入学生考试成绩。当我在“标记”列中输入标记时,它会根据输入的标记自动检查等级,并将其放入下一列(即“等级”),同一行。效果很好。当您有多行要输入标记时,就会出现问题。我们假设有三个学生要输入分数,如果您在最后一行中输入分数(学生在表中排在最后),则年级将不会更新。你必须从上到下顺序来更新等级。帮我解决这个问题。谢谢。这是我的代码:
for (int i = 0; i < jTable1.getRowCount(); i++) {
if(!(jTable1.getValueAt(i, 2).toString().equals(""))){