[Pixelle-commit] SF.net SVN: pixelle: [40] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-22 05:30:54
|
Revision: 40
http://pixelle.svn.sourceforge.net/pixelle/?rev=40&view=rev
Author: dbrosius
Date: 2008-06-21 09:21:30 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
when the last window closes, shutdown the app
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java 2008-06-21 03:11:14 UTC (rev 39)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/FrameMgr.java 2008-06-21 16:21:30 UTC (rev 40)
@@ -40,6 +40,8 @@
public void remove(JFrame frame) {
frames.remove(frame);
+ if (frames.size() == 0)
+ System.exit(0);
}
public Set<JFrame> getFrames() {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-21 03:11:14 UTC (rev 39)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleFrame.java 2008-06-21 16:21:30 UTC (rev 40)
@@ -22,6 +22,8 @@
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.util.ResourceBundle;
@@ -84,6 +86,7 @@
public PixelleFrame() {
initComponents();
+ initListeners();
setTitle(rb.getString("pixelle.title"));
}
@@ -173,6 +176,16 @@
cp.setLayout(new BorderLayout());
}
+ private void initListeners() {
+ addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent we) {
+ dispose();
+ FrameMgr.getInstance().remove(PixelleFrame.this);
+ }
+ });
+ }
+
public PixelleImage getImage() {
return image;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|