基本信息
源码名称:基于Swing的竞价查询系统
源码大小:7.10M
文件格式:.rar
开发语言:Java
更新时间:2018-01-26
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 3 元 
   源码介绍

连接Sqlite数据库,导入、导出excel,便于企业内部对竞品信息的查询

public boolean openFile(String btName) {
class ExcelFileFilter extends FileFilter {    
   public String getDescription() {    
       return "*.xls;*.xlsx";    
   }    
   
   public boolean accept(File file) {    
       String name = file.getName();    
       return file.isDirectory() || name.toLowerCase().endsWith(".xls") || name.toLowerCase().endsWith(".xlsx");  // 仅显示目录和xls、xlsx文件  
   }    
}
String defaultName="ProductInfo" StringUtils.datetoString(new Date()) ".xls";
int state=0;
JFileChooser jfc=new JFileChooser();  
ExcelFileFilter filter=new ExcelFileFilter();
       jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES );  
       jfc.setFileFilter(filter);
       jfc.setSelectedFile(new File(defaultName));
       if(btName.equals("export")){
        state=jfc.showDialog(new JLabel(), "导出");
       }else if(btName.equals("imput")){
        state=jfc.showDialog(new JLabel(), "导入");
       }
       if(1==state){
        return false;//取消,则返回
       }
       File file=jfc.getSelectedFile();
       if(file.isDirectory()){  
        setFilePath(file.getAbsolutePath());
        setFileName(defaultName);
        setRealPath(file.getAbsolutePath() "/" defaultName);
          //System.out.println("文件夹:" file.getAbsolutePath());  
       }else if(file.isFile()){  
       if(file.getName().endsWith(".xls")||file.getName().endsWith(".xlsx")){
        setFileName(file.getName());
        setRealPath(file.getAbsolutePath());
           System.out.println("文件:" file.getAbsolutePath());
       }else{
        JOptionPane.showMessageDialog(null,"<html> <font face= '宋体 ' size= '5'> <b>选择的文件类型不正确,请重新选择!</b> </font> </html> ");
       }
       } else if(file.isAbsolute()){
        setRealPath(file.getAbsolutePath());
        //System.out.println("文件路径:" excel.getRealPath()); 
       }
return true;
}