- All Implemented Interfaces:
public class ImageFishDisplay
- extends java.lang.Object
- implements IFishDisplay
Use an image file to display a fish.
- Mathias Ricken
Nested Class Summary
private static class
An image filter class that tints colors based on the tint provided to the constructor (the color of a fish).
Make an object that knows how to display a fish as an image.
Draw the fish.
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
private javax.swing.ImageIcon _icon
private java.awt.Image _originalImage
private double _radians
private java.util.HashMap _tintedVersions
public ImageFishDisplay(java.lang.String imageFilename,
- Make an object that knows how to display a fish as an image. Looks for the named file first in the jar file, then
in the current directory. If the named file is not found or the file is malformed, a colored circle will be
imageFilename - name of file containing image
radians - radians the fish has to be rotated by to make it face north
public void draw(java.awt.Graphics2D g,
- Draw the fish. The Graphics2D object has been set up so that the origin is in the center of the fish. A fish that
is 32x32 wide should thus drawFish from (-16,-16) to (16,16).
- Specified by:
draw in interface
g - graphics object to drawFish on.
comp - the component to drawFish on
fishColor - color of the fish