edu.kzoo.grid
Class PictureBlock

java.lang.Object
  |
  +--edu.kzoo.grid.GridObject
        |
        +--edu.kzoo.grid.PictureBlock

public class PictureBlock
extends GridObject

Grid Container Package:
A PictureBlock object encapsulates a picture (an image read from a file) to be put in a cell in a grid.

Version:
10 November 2004
Author:
Alyce Brady
See Also:
Grid, Location

Constructor Summary
PictureBlock(java.lang.String imageFilename, java.lang.String description)
          Constructs a picture block encapsulating the image in the specified file.
PictureBlock(java.lang.String imageFilename, java.lang.String description, Grid grid, Location loc)
          Constructs a picture block encapsulating the image in the specified file.
 
Method Summary
 javax.swing.ImageIcon pictureIcon()
          Gets picture associated with this picture block.
 java.lang.String toString()
          Returns the description of the picture provided to the constructor.
 
Methods inherited from class edu.kzoo.grid.GridObject
act, addToGrid, changeLocation, grid, isInAGrid, location, removeFromGrid, theGridObjectInvariantHolds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PictureBlock

public PictureBlock(java.lang.String imageFilename,
                    java.lang.String description)
Constructs a picture block encapsulating the image in the specified file. Looks for the named file first in the jar file, then in the current directory.

Parameters:
imageFilename - name of file containing image
description - description of this picture block object (used by the toString method)

PictureBlock

public PictureBlock(java.lang.String imageFilename,
                    java.lang.String description,
                    Grid grid,
                    Location loc)
Constructs a picture block encapsulating the image in the specified file. Looks for the named file first in the jar file, then in the current directory.

Parameters:
imageFilename - name of file containing image
description - description of this picture block object (used by the toString method)
grid - the grid containing this picture block
loc - the location of the picture block in grid
Method Detail

pictureIcon

public javax.swing.ImageIcon pictureIcon()
Gets picture associated with this picture block.


toString

public java.lang.String toString()
Returns the description of the picture provided to the constructor.

Overrides:
toString in class GridObject
Returns:
a string representation of this grid object