From ba085b0611979fc641da5bb1abe4995a57b57629 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 26 Sep 2011 10:04:53 +0100 Subject: [PATCH] avoid deprecation and ensure dialog close event is passed to client --- src/jalview/gui/JalviewDialog.java | 57 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/JalviewDialog.java b/src/jalview/gui/JalviewDialog.java index 4630cfc..3b10e86 100644 --- a/src/jalview/gui/JalviewDialog.java +++ b/src/jalview/gui/JalviewDialog.java @@ -4,6 +4,8 @@ import java.awt.Container; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import javax.swing.JButton; import javax.swing.JDialog; @@ -32,14 +34,14 @@ public abstract class JalviewDialog extends JPanel public void run() { - frame.show(); + frame.setVisible(true); } }).start(); } else { - frame.show(); + frame.setVisible(true); } } @@ -80,7 +82,56 @@ public abstract class JalviewDialog extends JPanel closeDialog(); } }); - + frame.addWindowListener(new WindowListener() + { + + @Override + public void windowOpened(WindowEvent e) + { + // TODO Auto-generated method stub + + } + + @Override + public void windowIconified(WindowEvent e) + { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeiconified(WindowEvent e) + { + // TODO Auto-generated method stub + + } + + @Override + public void windowDeactivated(WindowEvent e) + { + // TODO Auto-generated method stub + + } + + @Override + public void windowClosing(WindowEvent e) + { + // user has cancelled the dialog + closeDialog(); + } + + @Override + public void windowClosed(WindowEvent e) + { + } + + @Override + public void windowActivated(WindowEvent e) + { + // TODO Auto-generated method stub + + } + }); } /** * clean up and raise the 'dialog closed' event by calling raiseClosed -- 1.7.10.2