Add Row From on JTable to Another

I'm using two JTable that use a defualt table model.

My Code looks like this

JTable table;

publicvoid actionPerformed(ActionEvent e){

if(e.getSource().equals(searchButton)){

//tablePanel.removeAll();

DefaultTableModel model =new DefaultTableModel();

JTable table2 =new JTable(model);

// Create a couple of columns

model.addColumn("#");

model.addColumn("Category");

model.addColumn("Brand");

model.addColumn("Model");

model.addColumn("Code set");

model.addColumn("Location");

JScrollPane scrollpane =new JScrollPane(table2);

scrollpane.setPreferredSize(new Dimension(700,200));

scrollpane.setSize(700, 200);

//model.insertRow(table.getRow?); This Part Here

tablePanel.add(scrollpane);

setVisible(true);

}

}

Is there a way where I can just get on whole row from the data member JTable and insert it in the JTable being created?

[1587 byte] By [blackmagea] at [2007-11-27 10:32:33]
# 1

> Is there a way where I can just get on whole row from the data member JTable

No. You create a Vector and get each column separately using getValueAt(...) and then add the vector the the DefaultTableModel using the addRow() method.

camickra at 2007-7-28 18:17:24 > top of Java-index,Desktop,Core GUI APIs...