[Patchanim-commit] SF.net SVN: patchanim: [237] trunk/patchanim/src/com/mebigfatguy/patchanim/ gui
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-02-24 16:05:01
|
Revision: 237 http://patchanim.svn.sourceforge.net/patchanim/?rev=237&view=rev Author: dbrosius Date: 2008-02-24 08:05:05 -0800 (Sun, 24 Feb 2008) Log Message: ----------- split out file filter to separate class, and use in save dialog as well. Modified Paths: -------------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java Added Paths: ----------- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-24 16:01:04 UTC (rev 236) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/JPatchAnimFrame.java 2008-02-24 16:05:05 UTC (rev 237) @@ -343,20 +343,7 @@ try { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - chooser.setFileFilter(new FileFilter() { - - @Override - public boolean accept(File f) { - if (f.isDirectory()) - return true; - return (f.getPath().endsWith("paf")); - } - - @Override - public String getDescription() { - return "PatchAnim Files (*.paf)"; - } - }); + chooser.setFileFilter(new PatchAnimFileFilter()); chooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); int option = chooser.showOpenDialog(JPatchAnimFrame.this); if (option == JFileChooser.APPROVE_OPTION) { @@ -385,6 +372,7 @@ defLocation = documentLocation.getParentFile(); chooser.setCurrentDirectory(defLocation); + chooser.setFileFilter(new PatchAnimFileFilter()); int option = chooser.showSaveDialog(JPatchAnimFrame.this); if (option == JFileChooser.APPROVE_OPTION) { String path = chooser.getSelectedFile().getPath(); Added: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java =================================================================== --- trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java (rev 0) +++ trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java 2008-02-24 16:05:05 UTC (rev 237) @@ -0,0 +1,37 @@ +/* + * patchanim - A bezier surface patch color blend gif builder + * Copyright (C) 2008 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.patchanim.gui; + +import java.io.File; + +import javax.swing.filechooser.FileFilter; + +public class PatchAnimFileFilter extends FileFilter { + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + return (f.getPath().endsWith("paf")); + } + + @Override + public String getDescription() { + return "PatchAnim Files (*.paf)"; + } +} Property changes on: trunk/patchanim/src/com/mebigfatguy/patchanim/gui/PatchAnimFileFilter.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |