I am developing an address book for my classmates, but I have a problem with JTable . Here you can see a preview of the program, I am using NetBeans [ click ]. If you click Add to the Address Book , the program will add a new row to this table and fill its cells with data located in the text fields below. I use the following code, but the number of lines does not increase.

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { int h; DefaultTableModel model = new DefaultTableModel(); h=jTable1.getRowCount()+1; model.setRowCount(h); jTable1.setValueAt(jTextField2.getText(), h, 1); jTable1.setValueAt(jTextField3.getText(), h, 2);
Could you give me some tips on how to fix this problem?
source share