Java:Removing all the rows of DefaultTableModel

后端 未结 6 1471
盖世英雄少女心
盖世英雄少女心 2020-11-27 07:58

I want to delete all the rows of DefaultTable.I found two common ways to delete them on internet but none of them works in my case because those methods does not exist in my

6条回答
  •  执念已碎
    2020-11-27 08:33

    Why don't you read the javadoc of DefaultTableModel?

    public void removeRow(int row)

    Removes the row at row from the model. Notification of the row being removed will be sent to all the listeners.

    public void setDataVector(Vector dataVector, Vector columnIdentifiers)

    Replaces the current dataVector instance variable with the new Vector of rows, dataVector.

    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.

提交回复
热议问题