bookentry.java

来自「java swing 开发代码」· Java 代码 · 共 31 行

JAVA
31
字号
// BookEntry.java// A simple aggregate class to store a book's title and icon.//package	jswing.ch07;import javax.swing.ImageIcon;public class BookEntry {    private final String title;    private final String imagePath;    private ImageIcon image;    public BookEntry(String title, String imagePath) {        this.title = title;        this.imagePath = imagePath;    }    public String getTitle() { return title; }        public ImageIcon getImage() {        if (image == null) {            image = new ImageIcon(imagePath);        }        return image;    }    // Override standard toString method to give a useful result    public String toString() { return title; }}

⌨️ 快捷键说明

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