[Patchanim-commit] SF.net SVN: patchanim:[250] trunk/patchanim/src/com/mebigfatguy/patchanim/ gui/J
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-12-25 17:46:47
|
Revision: 250 http://patchanim.svn.sourceforge.net/patchanim/?rev=250&view=rev Author: dbrosius Date: 2008-12-25 17:46:43 +0000 (Thu, 25 Dec 2008) Log Message: ----------- add a focus listener so that when the test frame losses focus it closes. (As you could break stuff if you remove patches in the main window [index out of bounds exceptions]) Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-12-25 17:40:56 UTC (rev 249) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JTestFrame.java 2008-12-25 17:46:43 UTC (rev 250) @@ -21,6 +21,8 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.image.BufferedImage; @@ -44,7 +46,7 @@ private transient Thread animThread = null; private TestPanel testPanel = null; - private PatchAnimDocument document; + private final PatchAnimDocument document; private long lastRedraw; public JTestFrame() { @@ -115,6 +117,15 @@ dispose(); } }); + + this.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + super.focusLost(e); + endAnimation(); + dispose(); + } + }); } class TestPanel extends JPanel { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |