In the swing application, JDialog box is used to display the list of persons. So that users can select the appropriate persons from the displayed list.
Now the problem is, this JDialog will be opened when we click on a button. There are many other buttons in the same JFrame. Each button will display different kind of information based on the input given in the textfield next to the button. When I click on a button JDialog opens, but when I click on the another button new JDialog opens, but the first one is still open(existing is not closed yet).
JDialog which is opened should be closed automatically when another button is opened. For example if I open a new JDialog box without closing existing open JDialog now both the Dialog boxes are opened together.
I request to provide few hints on this.
Here is the sample code :