如何实现上传文件时浏览只显示与类型匹配的文件 在上传文件的时候如何再点击浏览按钮后 只显示EXCLE文件和文件夹 其他不显示 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 OpenFileDialog ofd = new OpenFileDialog();ofd.Filter = "Text Document(*.txt)|*.txt|All Files|*.*|我要显示的文件类型(*.exe)|*.exe";//设置文件过滤器用于打开文件对话框中显示特定类型的文件ofd.ShowDialog();或者 JFileChooser chooser = new JFileChooser(new File("c:\\")); chooser.setFileFilter(new FileFilter() { public String getDescription() { // TODO Auto-generated method stub return null; } public boolean accept(File f) { // TODO Auto-generated method stub if(f.isDirectory())return true; else return f.getName().endsWith(".gif"); } }); chooser.showOpenDialog(null);这个只显示gif,当然其他类型可以自己控制 有个弱智问题请教下, java.lang.integer weblogic频繁宕机,原因何在? 日期转变 能不能给我介绍一个jsp好的教程!!! 关于地址栏传递参数问题!!! 请教一个问题??? 寻精通java applet+MySQL者 使用BASE64Encoder编码和BASE64Decoder解码中文时,偶数字的显示正常,但奇数就会在最后显示“?”,请高手帮忙 请问在JAVA,jsp中是否有像ASP中 hibernate3.6.5需要导入的包 最近在看jquery,谁那里有比较好的jquery的资料啊
ofd.Filter = "Text Document(*.txt)|*.txt|All Files|*.*|我要显示的文件类型(*.exe)|*.exe";//设置文件过滤器用于打开文件对话框中显示特定类型的文件
ofd.ShowDialog();
或者
JFileChooser chooser = new JFileChooser(new File("c:\\"));
chooser.setFileFilter(new FileFilter() {
public String getDescription()
{
// TODO Auto-generated method stub
return null;
}
public boolean accept(File f)
{
// TODO Auto-generated method stub
if(f.isDirectory())return true;
else
return f.getName().endsWith(".gif");
}
});
chooser.showOpenDialog(null);
这个只显示gif,当然其他类型可以自己控制