The dispose
will free up your memory. All data for the dialog are gone. If you want to show the window later again you have to work with visibility. This can be checked with isVisible()
.
You can replace the dispose()
in your code with this.setVisible(false)
public static String get() {
FenetreAjoutClass dialog = new FenetreAjoutClass(null, false);
while (dialog.isVisible()) {
System.out.println("is Visible");
}
System.out.println("is not Visible");
return infos;
}
Mind that the console will still print "is Visible" over a short time after the dialog is closed. But this is because the console can does not print as quick as the while loop restarts.