Removing a row from a jtable

Leave a Comment
removeRow( int row_index ):This method is used to remove the row from the model. It takes integer type row index that means its position or location in a table.
  row_index: This is the index of row that have to removed.


Code snippet

DefaultTableModel model = new DefaultTableModel(data,col);
  JTable table = new JTable(model);

//the line of code below removes the first  row from the table
 model.removeRow(0);
//This removes the last row of the table
model.removeRow(table.getRowCount()-1);




other related links

Creating a JTable

0 comments:

Post a Comment