1 48 49 50 package org.exolab.jms.tools.admin; 51 52 import java.io.File ; 53 54 import javax.swing.filechooser.FileFilter ; 55 56 57 64 public class DatabaseFilter extends FileFilter { 65 66 70 public DatabaseFilter() { 71 72 } 73 74 75 85 public boolean accept(File f) { 86 boolean accept = f.isDirectory(); 87 88 if (!accept) { 89 String suffix = getSuffix(f); 90 91 if (suffix != null) { 92 accept = suffix.equals("db"); 93 } 94 } 95 return accept; 96 } 97 98 104 public String getDescription() { 105 return "Database Files(*.db)"; 106 } 107 108 109 116 public String getSuffix(File f) { 117 String s = f.getPath(); 118 String suffix = null; 119 120 int i = s.lastIndexOf('.'); 121 if (i > 0 && i < s.length() - 1) { 122 suffix = s.substring(i + 1).toLowerCase(); 123 } 124 return suffix; 125 } 126 127 128 } | Popular Tags |