FileDocCategorySizeDatePackage
CartoonBean.javaAPI DocExample1332Tue Feb 28 11:34:06 GMT 2006com.ora.jsp.beans.motd

CartoonBean

public class CartoonBean extends Object implements Serializable
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
version
1.0

Fields Summary
private static int
index
private List
fileNames
Constructors Summary
public CartoonBean()
Constructor that creates an internal data structure to hold the image file names.


                      
      
        initFileList();
    
Methods Summary
public java.lang.StringgetFileName()
Returns a new file name every time it's called, cycling through all available image files.

        index++;
        if (index > fileNames.size() - 1) {
            index = 0;
        }
        return (String) fileNames.get(index);
    
private voidinitFileList()
Creates and initializes a data structure to hold the image file names.

        fileNames = new ArrayList();
        fileNames.add("dilbert2001113293109.gif");
        fileNames.add("dilbert2001166171101.gif");
        fileNames.add("dilbert2001166171108.gif");
        fileNames.add("dilbert2731150011029.gif");