Regarding adding row to JTable, I found this useful answers for this question How to add row in JTable?.
I am confusing a little bit about this code:
DefaultTableModel model = (DefaultTableModel) jtable.getModel();
model.addRow(new Object[]{"Column 1", "Column 2", "Column 3"});
The JTable was already set with a table model. My understanding in the first line of code is that it assigns the DefaultTableModel model (lets call newmodel) with the model from table, and this newmodel does not attach to the table (because it is not set to table using setModel()).
So how can the addRow method performed by this newmodel insert new row to Jtable?