public class PictureBlock extends GridObject
PictureBlock
object encapsulates a picture (an image
read from a file) to be put in a cell in a grid.Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
act, addToGrid, changeLocation, grid, isInAGrid, location, removeFromGrid, theGridObjectInvariantHolds
public PictureBlock(java.lang.String imageFilename, java.lang.String description)
imageFilename
- name of file containing imagedescription
- description of this picture block object (used
by the toString
method)public PictureBlock(java.lang.String imageFilename, java.lang.String description, Grid grid, Location loc)
imageFilename
- name of file containing imagedescription
- description of this picture block object (used
by the toString
method)grid
- the grid containing this picture blockloc
- the location of the picture block in grid
public javax.swing.ImageIcon pictureIcon()
public java.lang.String toString()
toString
in class GridObject