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

📄 imagefileview.java

📁 图片浏览GUI源代码 以前做了个图片浏览器
💻 JAVA
字号:
import java.io.File;import javax.swing.*;import javax.swing.filechooser.*;/* ImageFileView.java is used by FileChooserDemo2.java. */public class ImageFileView extends FileView {    ImageIcon jpgIcon = Utils.createImageIcon("images/jpgIcon.gif");    ImageIcon gifIcon = Utils.createImageIcon("images/gifIcon.gif");    ImageIcon tiffIcon = Utils.createImageIcon("images/tiffIcon.gif");    ImageIcon pngIcon = Utils.createImageIcon("images/pngIcon.png");    public String getName(File f) {        return null; //let the L&F FileView figure this out    }    public String getDescription(File f) {        return null; //let the L&F FileView figure this out    }    public Boolean isTraversable(File f) {        return null; //let the L&F FileView figure this out    }    public String getTypeDescription(File f) {        String extension = Utils.getExtension(f);        String type = null;        if (extension != null) {            if (extension.equals(Utils.jpeg) ||                extension.equals(Utils.jpg)) {                type = "JPEG Image";            } else if (extension.equals(Utils.gif)){                type = "GIF Image";            } else if (extension.equals(Utils.tiff) ||                       extension.equals(Utils.tif)) {                type = "TIFF Image";            } else if (extension.equals(Utils.png)){                type = "PNG Image";            }        }        return type;    }    public Icon getIcon(File f) {        String extension = Utils.getExtension(f);        Icon icon = null;        if (extension != null) {            if (extension.equals(Utils.jpeg) ||                extension.equals(Utils.jpg)) {                icon = jpgIcon;            } else if (extension.equals(Utils.gif)) {                icon = gifIcon;            } else if (extension.equals(Utils.tiff) ||                       extension.equals(Utils.tif)) {                icon = tiffIcon;            } else if (extension.equals(Utils.png)) {                icon = pngIcon;            }        }        return icon;    }}

⌨️ 快捷键说明

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