MyTableModel 这个类是你自己封装的吧?
setRowCount()方法中有没有给getRowCount()方法获得的属性赋值????

解决方案 »

  1.   

    看下API。0小于当前size的话,当前index及大于index的将被discardhttp://docs.oracle.com/javase/7/docs/api/javax/swing/table/DefaultTableModel.html#setRowCount(int)public void setRowCount(int rowCount)
    Sets the number of rows in the model. If the new size is greater than the current size, new rows are added to the end of the model If the new size is less than the current size, all rows at index rowCount and greater are discarded.
    Since:
    1.3
    See Also:
    setColumnCount(int)