⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svgexportfilefilter.java

📁 完全基于java开发的svg矢量绘图工具
💻 JAVA
字号:
package fr.itris.glips.svgeditor.svgfile.export;import java.io.*;import java.util.*;/** * the class for filtering files in a JFileChooser *  * @author Jordi SUC */public class SVGExportFileFilter extends javax.swing.filechooser.FileFilter {    /**     * the type of the filter     */    protected int type=-1;        /**     * the description of the filter     */    protected String messagefilter="";        /**     * the constructor of the class     * @param a resource bundle     * @param filterType the type of the filter     */    public SVGExportFileFilter(ResourceBundle bundle, int filterType) {        this.type=filterType;                if(bundle!=null){                        try{                                switch(type) {                                    case SVGExport.JPG_FORMAT :                                                messagefilter=bundle.getString("messageexportfilterjpg");                        break;                                            case SVGExport.PNG_FORMAT :                                                messagefilter=bundle.getString("messageexportfilterpng");                        break;                                            case SVGExport.BMP_FORMAT :                                                messagefilter=bundle.getString("messageexportfilterbmp");                        break;                                            case SVGExport.TIFF_FORMAT :                                                messagefilter=bundle.getString("messageexportfiltertiff");                        break;                                            case SVGExport.PDF_FORMAT :                                                messagefilter=bundle.getString("messageexportfilterpdf");                        break;                }            }catch (Exception ex){}        }    }    /**     * Whether the given file is accepted by this filter     * @param f a file     * @return true to accept the file     */    public boolean accept(File f) {                String name=f.getName().toLowerCase();                boolean accept=false;                if(f.isDirectory() || name.indexOf(".")==-1) {                        accept=true;        }else {                        switch(type) {                            case SVGExport.JPG_FORMAT :                                        accept=name.endsWith(".jpg");                    break;                                    case SVGExport.PNG_FORMAT :                                        accept=name.endsWith(".png");                    break;                                    case SVGExport.BMP_FORMAT :                                        accept=name.endsWith(".bmp");                    break;                                    case SVGExport.TIFF_FORMAT :                                        accept=name.endsWith(".tiff");                    break;                                    case SVGExport.PDF_FORMAT :                                        accept=name.endsWith(".pdf");                    break;            }        }                return accept;    }    /**     * The description of this filter     * @return the description of the files that must be selected     */    public String getDescription() {        return messagefilter;    }        /**     * Whether the given file is accepted by this filter     * @param f a file     * @return true to accept the file     */    public boolean acceptFile(File f) {                return accept(f);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -