The first JTable created uses a two-dimensional object array to populate the row data and a String array to populate the column names.
The program shows that although you can get to the TableModel interface of the table model to get and set values for individual table cells created for this JTable , you cannot get to the DefaultTableModel in order to manipulate the data.
The second JTable is created by defining a DefaultTableModel with the data first. This allows the full range of actions by the table model to be performed on the JTable(e.g, adding a row, inserting a row, removing a row, adding a column, etc.).
You might also be interested in the AbstractTableModel class. This class allows you to create a custom table model for a JTable where you can store the data in anyway you like. It does not have to be in a Vector of Vectors.
defaulttablemodel setvalueatjtable model examplejtable get default table modeldefaulttablemodel syntaxdefaulttablemodel examplejtable in java with databasejtable setmodeljtable setrowselectionintervaldefaulttablemodel tutorialjtabledefaulttablemodel ()oracle defaulttablemodeldefaulttablemodel remove all rows