Reputation: 9478
I am implementing JTable as user registration form, I am almost done, but when an data is added its not showing latest data entered and also the size of JTable is very small. How can i increase that?
code is in below link JTable Implementation
Upvotes: 1
Views: 395
Reputation: 16
use this
DefaultTableModel myData = new DefaultTableModel();
JTable table = new JTable(myData);
// initialize the table with model type constructor
String offer = "pankaj ";
Object [] rowData=new Object[]{offer,null};
//convert string into object array myData.addRow(rowData);
//use addRow(Object[] rowData) method of defaulttablemodel class
Upvotes: 0
Reputation: 347184
Your table won't magically know when you've added data unless you tell it.
Take a look at DefaultTableModel#addRow
Once you've inserted your new row into the data base, you need to add it to the table model.
Take a look at How to Use Tables
Upvotes: 5