可以更新,JTable的数据实际上存在一个TableModel中
一般是
DefaultTableModel的一个实例。
从jdk文档中可以看到这个model中有一个类变量
protected Vector dataVector
The Vector of Vectors of Object values.
用来保存数据。
所以用户完全可以在运行时候随时改变用DefaultTableModel model = (DefaultTableModel)table.getTableModel();然后可以调用下边的方法之一void addRow(Object[] rowData)
Adds a row to the end of the model.
void addRow(Vector rowData)
Adds a row to the end of the model.
一般是
DefaultTableModel的一个实例。
从jdk文档中可以看到这个model中有一个类变量
protected Vector dataVector
The Vector of Vectors of Object values.
用来保存数据。
所以用户完全可以在运行时候随时改变用DefaultTableModel model = (DefaultTableModel)table.getTableModel();然后可以调用下边的方法之一void addRow(Object[] rowData)
Adds a row to the end of the model.
void addRow(Vector rowData)
Adds a row to the end of the model.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货