diff options
| author | Keith Packard <keithp@keithp.com> | 2014-06-07 11:52:28 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2014-06-07 12:34:15 -0700 | 
| commit | d550c3b3eccbb0283c588b5df69edb2e9b44b4cc (patch) | |
| tree | 838eccb03fc795a361268395048c98d59284b74f /telegps/TeleGPSGraphUI.java | |
| parent | 9f2189e0b99aa32b788ecb4576dcb9bcc926f4e2 (diff) | |
telegps: Track graph windows as one of the TeleGPS windows
TeleGPS exits when the number of windows goes to zero; track graphing
windows in addition to the usual flight monitoring windows.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'telegps/TeleGPSGraphUI.java')
| -rw-r--r-- | telegps/TeleGPSGraphUI.java | 24 | 
1 files changed, 23 insertions, 1 deletions
| diff --git a/telegps/TeleGPSGraphUI.java b/telegps/TeleGPSGraphUI.java index b7c17780..84c80815 100644 --- a/telegps/TeleGPSGraphUI.java +++ b/telegps/TeleGPSGraphUI.java @@ -21,7 +21,11 @@ import java.io.*;  import java.util.ArrayList;  import java.awt.*; +import java.awt.event.*;  import javax.swing.*; +import java.io.*; +import java.util.concurrent.*; +import java.util.*;  import org.altusmetrum.altoslib_4.*;  import org.altusmetrum.altosuilib_2.*; @@ -46,6 +50,12 @@ public class TeleGPSGraphUI extends AltosUIFrame  		}  	} +	private void close() { +		setVisible(false); +		dispose(); +		TeleGPS.subtract_window(); +	} +  	TeleGPSGraphUI(AltosStateIterable states, File file) throws InterruptedException, IOException {  		super(file.getName());  		state = null; @@ -65,11 +75,23 @@ public class TeleGPSGraphUI extends AltosUIFrame  		setContentPane (pane); +		addWindowListener(new WindowAdapter() { +				@Override +				public void windowClosing(WindowEvent e) { +					close(); +				} +			}); +  		pack(); -		setDefaultCloseOperation(DISPOSE_ON_CLOSE); +		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + +		TeleGPS.add_window(); +  		setVisible(true); +  		if (state != null)  			map.centre(state); +  	}  } | 
