如何在JTable中动态添加一行
JTable tbImage = new JTable(5,5);//create a dummy table
DefaultTableModel dtm=(DefaultTableModel)tbImage.getModel();
dtm.addRow(...);
Vector vData = new Vector();
Vector vName = new Vector();
vName.add("column1");
vName.add("column2");
Vector vRow = new Vector();
vRow.add("cell 0 0");
vRow.add("cell 0 1");
vData.add(vRow.clone());
vData.add(vRow.clone());
DefaultTableModel model = new DefaultTableModel(vData, vName);
JTable jTable1 = new JTable();
jTable1.setModel(model);
Vector vRow1 = new Vector();
vRow1.add("cell 2 0");
vRow1.add("cell 2 1");
vData.add(vRow1);
model = new DefaultTableModel(vData, vName);
jTable1.setModel(model);