From e4372605fb3b3d1f01a61cae6a56c709774a51ee Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 22 Mar 2007 09:34:50 +0000 Subject: [PATCH] bug fix for when disposing window --- .../contikimote/ContikiMoteTypeDialog.java | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java index e04be2b8f..b170be817 100644 --- a/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java +++ b/tools/cooja/java/se/sics/cooja/contikimote/ContikiMoteTypeDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ContikiMoteTypeDialog.java,v 1.15 2007/01/10 08:48:13 fros4943 Exp $ + * $Id: ContikiMoteTypeDialog.java,v 1.16 2007/03/22 09:34:50 fros4943 Exp $ */ package se.sics.cooja.contikimote; @@ -126,7 +126,8 @@ public class ContikiMoteTypeDialog extends JDialog { final ContikiMoteTypeDialog myDialog = new ContikiMoteTypeDialog( parentFrame); - + myDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); + myDialog.myMoteType = moteTypeToConfigure; myDialog.myGUI = simulation.getGUI(); myDialog.allOtherTypes = simulation.getMoteTypes(); @@ -807,6 +808,31 @@ public class ContikiMoteTypeDialog extends JDialog { contentPane.add(mainScrollPane, BorderLayout.CENTER); contentPane.add(buttonPane, BorderLayout.SOUTH); + addWindowListener(new WindowListener() { + public void windowDeactivated(WindowEvent e) { + } + + public void windowIconified(WindowEvent e) { + } + + public void windowDeiconified(WindowEvent e) { + } + + public void windowOpened(WindowEvent e) { + } + + public void windowClosed(WindowEvent e) { + } + + public void windowActivated(WindowEvent e) { + } + + public void windowClosing(WindowEvent e) { + myMoteType = null; + dispose(); + } + }); + // pack(); }