I have created a frame x1 which has a panel p1. When x1 is loaded, checkboxes are added dynamically to p1. The number of checkboxes added to p1 depend on the number of data values in the database table(t1) that satisfy a particular criteria.
There is a button b1 on frame x1. When b1 is clicked,it displays another frame x2 in which data values of the database table t1 can be modified. A button 'update' in x2,updates t1 to reflect the changes made to its data values.
After modification,when x2 is closed I want the panel p1 in frame x1 to be updated automatically to reflect the changes made to the database ie the number of data values satisfying the criteria might have changed after modifictaion of t1 in x2 and hence,the number of check boxes to be displayed on p1 might have changed as well.
How do I refresh and reload the components of panel p1 in x1 from x2.
Was wondering if anyone could help me fix the problem. Thanks in advance and sorry about the load of text in the question.
In x2:
private void UPDATEActionPerformed(java.awt.event.ActionEvent evt)
{
//x1 is an object of ParentFrame
ParentFrame f1=new ParentFrame();
f1.fillPanel();
//fillpanel()fills p1 with checkboxes after running validate() and repaint() on it
}