Search code examples
javaswingjtabletablemodel

How to add new row in jtable while click a button


Possible Duplicate:
Adding rows to a JTable

I am creating a jTable. Initially it has no rows.If we click "add" button a new row will insert.Is it possible to do this in a jTable?


Solution

  • Update your underlying TableModel and fire the appropriate event. Or, if you use an extension of DefaultTableModel, use the addRow method.

    Consult the table tutorial for more information.