|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.kzoo.grid.display.ScaledDisplay | +--edu.kzoo.grid.display.ScaledImageDisplay
Grid Display Package:
A ScaledImageDisplay
uses an image read from a file to
represent an object in a location in a grid. Images can be rotated
or tinted using appropriate decorators. ScaledImageDisplay
provides a tint
method that can be used by a
tint decorator.
Constructor Summary | |
protected |
ScaledImageDisplay()
Internal constructor that does not initialize the icon instance variable; subclasses must be sure to set the icon using the setIcon method (e.g., at the beginning
of a redefined draw method). |
|
ScaledImageDisplay(java.lang.String imageFilename)
Constructs an object that knows how to display a GridObject object as an image. |
Method Summary | |
void |
draw(GridObject obj,
java.awt.Component comp,
java.awt.Graphics2D g2)
Draws a unit-length object using an image. |
protected javax.swing.ImageIcon |
getIcon()
Returns the image to use for display purposes. |
boolean |
imageLoadedOK()
Returns true if the image loaded OK; false
otherwise. |
protected void |
setIcon(javax.swing.ImageIcon icon)
Defines the image to use for display purposes. |
Methods inherited from class edu.kzoo.grid.display.ScaledDisplay |
addDecorator, adjust, draw, removeDecorator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ScaledImageDisplay()
setIcon
method (e.g., at the beginning
of a redefined draw method).
public ScaledImageDisplay(java.lang.String imageFilename)
imageFilename
parameter may name a file in the jar file, may be the absolute
name of a file in the current file system, or may be the name
of a file in the current directory.
imageFilename
- name of file containing imageMethod Detail |
public boolean imageLoadedOK()
true
if the image loaded OK; false
otherwise.
protected void setIcon(javax.swing.ImageIcon icon)
protected javax.swing.ImageIcon getIcon()
public void draw(GridObject obj, java.awt.Component comp, java.awt.Graphics2D g2)
draw
in class ScaledDisplay
obj
- object we want to drawcomp
- the component we're drawing ong2
- drawing surface
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |