What listener should I register in a JFrame
instance to be notified if a modal JDialog
is shown on top of the frame (the frame is the owner of the dialog)? Thanks in advance.
I think JFrame.addWindowListener(...) would work and then pay attention to WindowListener.windowDeactivated(...)
ETA:
jFrame.addWindowListener(new WindowAdapter() {
@Override
public void windowDeactivated(WindowEvent e) {
if(e.getOppositeWindow() instanceof JDialog) {
JDialog dialog = (JDialog) e.getOppositeWindow();
if(dialog.isModal()) {
// do stuff
}
}
}
});