cellelement.java

来自「Java资源管理器」· Java 代码 · 共 42 行

JAVA
42
字号
/*
 * Created on 2005-5-7
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gui;

import java.io.File;

import javax.swing.ImageIcon;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class CellElement {
    private ImageIcon folderIcon;
    private ImageIcon fileIcon;
    private ImageIcon unknow;
    private File file;
    
    public CellElement(File file){
        this.file = file;
        folderIcon = new ImageIcon("icons\\foldercolse.png");
        fileIcon = new ImageIcon("icons\\file.png");
        unknow = new ImageIcon("icons\\unknow.gif");
    }
    public ImageIcon getImageIcon(){
      if(file.isDirectory())  
           return folderIcon; 
       else if(file.isFile())
           return fileIcon;
       else return unknow;
    }
    public File getFile(){
        return file;
    }
}

⌨️ 快捷键说明

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