Here you can find the source of addRowsToTable(Vector rows, int colCount)
public static DefaultTableModel addRowsToTable(Vector rows, int colCount) throws Exception
//package com.java2s; /*//from w ww . java2s . c o m * Id: * * Copyright (C) 2004, Cladonia Ltd. All rights reserved. * * This software is the proprietary information of Cladonia Ltd. * Use is subject to license terms. */ import java.util.Vector; import javax.swing.table.DefaultTableModel; public class Main { public static DefaultTableModel addRowsToTable(Vector rows, int colCount) throws Exception { int rowCount = rows.size(); //int rowsFromTM = tableModel.getRowCount(); DefaultTableModel tableModel = new DefaultTableModel(); //Vector headerValues = new Vector(); /*for (int cnt = 0; cnt < rowsFromTM; ++cnt) { tableModel.removeRow(0); }*/ tableModel.setColumnCount(colCount); for (int cnt = 0; cnt < rowCount; ++cnt) { String[] rowData = (String[]) rows.get(cnt); tableModel.addRow(rowData); } return (tableModel); } }