From 1f07ccd611d6e8d2438b9b209b23c8544eb856d0 Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@maiil.ru> Date: Fri, 21 Dec 2018 23:20:48 +0100 Subject: [PATCH] Preparation for better close action --- src/opensesim/gui/SeSimApplication.form | 3 +++ src/opensesim/gui/SeSimApplication.java | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/opensesim/gui/SeSimApplication.form b/src/opensesim/gui/SeSimApplication.form index 4189e3c..fc69e3e 100644 --- a/src/opensesim/gui/SeSimApplication.form +++ b/src/opensesim/gui/SeSimApplication.form @@ -305,6 +305,9 @@ + + + diff --git a/src/opensesim/gui/SeSimApplication.java b/src/opensesim/gui/SeSimApplication.java index 6e55fa7..6ba4137 100644 --- a/src/opensesim/gui/SeSimApplication.java +++ b/src/opensesim/gui/SeSimApplication.java @@ -254,6 +254,11 @@ public class SeSimApplication extends javax.swing.JFrame { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(640, 480)); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/opensesim/resources/icons/stop.gif"))); // NOI18N stopButton.setText("Stop"); @@ -580,6 +585,7 @@ public class SeSimApplication extends javax.swing.JFrame { }// //GEN-END:initComponents private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed + dispose(); System.exit(0); }//GEN-LAST:event_exitMenuItemActionPerformed @@ -979,6 +985,11 @@ public class SeSimApplication extends javax.swing.JFrame { ExchangeListDialog.runDialog(this, godworld); }//GEN-LAST:event_exchangesMenuItemActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + // TODO add your handling code here: + System.out.printf("Closing Windows\n"); + }//GEN-LAST:event_formWindowClosing public static class Pojo { public String getSymbol() {