Click to See Complete Forum and Search --> : How do you ADD and Delete Rows in a JTABLE in JDK1.2.2?


August 13th, 1999, 02:30 PM
I have a table that is filled using a the (Vector, Vector) constructor. I need the ability to add and delete rows in the table while it is displayed. Basically it is so users can add new datasets, and remove chosen rows. I only saw API's for adding columns. Any examples would be great...

Thanks,
Jay

August 17th, 1999, 02:45 AM
Just set a TableModel for your JTable and use DefaultTableModel as your TableModel. In your Def

Azeem
February 8th, 2000, 12:19 AM
use the DefaultTableModel as the tablemodel
and use removeRow(int RowNumber) to remove a particular row and
addRow(Object) to add a row at the end.

if u want to remove all the rows, use setRowNum(0) using the underlying TableModel instance.

plz rate the solutions so that ppl get encouraged to respond to questions.