I created an initial JFrame that contains a table with three columns, as shown below:
This JFrame was created in design mode, and so now in the panel's constructor, I want to load some data so when the user selects to open this JFrame, the data is loaded.
My column data types are Object (generally 'Status' is for an image representing the status of the share - active or inactive), String for the share's name and integer for the number of active clients connected to that share.
My question is, how to I add rows to a JTable via code?
In a simplified way (can be improved):
Then, in the panel's constructor:
And for add a line:
EDIT:
To alter a column's header name:
JTable has two levels (as you posted printscreen) talking about view,
there is (hidden) XxxTableModel which stores the values,
in the
XxxTableModel
you can to call myTableModel#addRowsimple example