I have a Java app that displays a list from a database. Inside the class is the following code to open a new dialog for data entry:
@Action
public void addNe
If AddNewView
is a Window such as a Dialog or JDialog, you could use the Window.addWindowListener(...). That is, in your main class, you do
addNewDialog.addWindowListener(someWindowListener);
where someWindowListener
is some WindowListener (for instance a WindowAdapter) which overrides / implemetnns windowClosed.
A more complete example, using an anonymous class, could look like
addNewDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
refreshMainView();
}
});
Relevant links:
you have to add WindowListener and override windowClosing Event, if event occured then just returs some flag, example here