Hi guys I'm new here so please bear with me..
I have two jframe forms. The main form which is Talaan and the second jframe form which is AddRecord..
The main Talaan is to populate data in Table from the database with method
Talaan populate = new Talaan();
The main form which is Talaan and the second jframe form which is AddRecord..
An application should only have a single JFrame. The second window should be a modal
when i call the second form AddRecord which is used for adding records
When you click the "Add Record" button on the dialog you need to add the data from the dialog to the DefaultTableModel of the JTable.
So the easiest way to do this is to pass the DefaultTableModel as a parameter to your "AddRecord" class. then you can just use the
addRow(...) method of the
DefaultTableModel to add the data to the table.
Or, if you want to reread all the data from the database again, then your method to get the data from the database should return a
TableModel object. Then you can just update the
table.setModel( theUpdatedTableModel );
Your question is way to vague to give a specific answer.
how do I call checkDB() method from AddRecord..
checkDB method belongs to the
Taalan class. So you need to pass the
Taalan class as a parameter to the
This is basic Java. If you want to invoke a method on a class then you need to have a reference to the class.