From: jprocter Date: Mon, 26 Sep 2011 09:04:53 +0000 (+0100) Subject: avoid deprecation and ensure dialog close event is passed to client X-Git-Tag: Release_2_7~21 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ba085b0611979fc641da5bb1abe4995a57b57629;p=jalview.git avoid deprecation and ensure dialog close event is passed to client --- 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