I am working on a JAVA desktop application that has two frames, users clicks a button on frame 1, response based on the selected option would be updated to the database. While the response is being updated, frame 2 should be displayed.
If I set the frame 2 to visible before the database update, frame 2 is displayed but with empty content i.e panels of frame 2 are not displayed. But once the database update is completed, the contents of the frame are shown.
button1.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame1.setVisible(false);
frame2.setVisible(true);
Utilities.updateToDB("clicked button1");
}
});
Content of Frame 2 should be shown while the database update is taking place or before it.