| 1 | |
package de.glossmaker.gui.gloss; |
| 2 | |
|
| 3 | |
import java.io.File; |
| 4 | |
|
| 5 | |
import javax.swing.JFileChooser; |
| 6 | |
import javax.swing.filechooser.FileFilter; |
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
public class GlossFileChooser extends JFileChooser { |
| 16 | |
private static final long serialVersionUID = 6999327231280829888L; |
| 17 | |
|
| 18 | 0 | public GlossFileChooser(final String title, final String description, final String extension) { |
| 19 | 0 | this.setFileFilter(new FileFilter() { |
| 20 | |
|
| 21 | |
@Override |
| 22 | |
public String getDescription() { |
| 23 | 0 | return description + " (*." + extension + ")"; |
| 24 | |
} |
| 25 | |
|
| 26 | |
@Override |
| 27 | |
public boolean accept(File f) { |
| 28 | 0 | return f.getAbsolutePath().endsWith(extension) || |
| 29 | |
f.isDirectory(); |
| 30 | |
} |
| 31 | |
}); |
| 32 | 0 | } |
| 33 | |
|
| 34 | |
} |