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

📄 selectfile.java

📁 页面抓取新闻并自动生成网页的代码 有兴趣的可以看看,很有意思的东西
💻 JAVA
字号:
package admin;
import java.sql.*;
import java.io.*;
import java.util.Date;
import java.text.SimpleDateFormat;

public class SelectFile{
	private String DialogType;
	private String path="";
	private File [] fileList=null;
	private String[][] reList;
	public String [][] newFile(String path,String DialogType){
		this.path=path;
		this.DialogType=DialogType;
	  File f1=new File(path);
	  if(f1.isDirectory()){
      if(DialogType.equals("pic"))fileList=f1.listFiles(new FileterPics());
      reList=new String[fileList.length][3];
      for(int i=0;i<fileList.length;i++){
      	reList[i][0]=String.valueOf(fileList[i].getName()); //名称
      	reList[i][1]=String.valueOf(fileList[i].length()); //长度
      	long timer=fileList[i].lastModified(); //最后修改时间
      	Date formatTime=new Date(timer);   //时间格式化
      	SimpleDateFormat thisformat=new SimpleDateFormat();
        thisformat.applyPattern("yyyy-MM-dd HH:mm:ss");
      	reList[i][2]=thisformat.format(formatTime); 
      	}
		  return reList;
		  }
		return reList; 
		}
	}

class FileterPics implements FilenameFilter{ //设置过滤器,此为过滤图片
	public boolean accept(File dir, String name){
		String fileDir=dir.toString();
		String fileName=name;
		int pix=fileName.lastIndexOf(".");
		String exName=fileName.substring(pix+1);
		return (exName.equals("jpg")|exName.equals("gif")|exName.equals("bmp")|exName.equals("png")|exName.equals("JPG")|exName.equals("GIF")|exName.equals("BMP")|exName.equals("PNG"));
		}
	}	

⌨️ 快捷键说明

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