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

📄 cartoonbean.java

📁 JSP设计(第三版)一书源代码 JSP设计(第三版)》得到了充分的修订和更新
💻 JAVA
字号:
package com.ora.jsp.beans.motd;

import java.util.*;
/**
 * This is an example of a simple bean with one property that holds
 * names of image files. Every time the property is read, a new
 * file name is returned.
 *
 * @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
 * @version 1.0
 */
public class CartoonBean implements java.io.Serializable {
    private static int index = -1;
    private List fileNames;

    /**
     * Constructor that creates an internal data structure to hold
     * the image file names.
     */
    public CartoonBean() {
        initFileList();
    }

    /**
     * Returns a new file name every time it's called, cycling through
     * all available image files.
     */
    public String getFileName() {
        index++;
        if (index > fileNames.size() - 1) {
            index = 0;
        }
        return (String) fileNames.get(index);
    }

    /**
     * Creates and initializes a data structure to hold the image file
     * names.
     */
    private void initFileList() {
        fileNames = new ArrayList();
        fileNames.add("dilbert2001113293109.gif");
        fileNames.add("dilbert2001166171101.gif");
        fileNames.add("dilbert2001166171108.gif");
        fileNames.add("dilbert2731150011029.gif");
    }
}

⌨️ 快捷键说明

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