public abstract class ScaledDisplay extends java.lang.Object implements GridObjectDisplay
GridObject
object. The class will translate and
scale the graphics system as needed and then invoke its
abstract draw
method. Subclasses of this abstract class
define draw
to just display an object with a fixed size.Constructor and Description |
---|
ScaledDisplay() |
Modifier and Type | Method and Description |
---|---|
void |
addDecorator(DisplayDecorator d)
Add a Decorator to the display in order to add some functionality.
|
protected void |
adjust(GridObject obj,
java.awt.Component comp,
java.awt.Graphics2D g2)
Adjusts the graphics system for drawing an object, as appropriate.
|
abstract void |
draw(GridObject obj,
java.awt.Component comp,
java.awt.Graphics2D g2)
Draw the given GridObject object.
|
void |
draw(GridObject obj,
java.awt.Component comp,
java.awt.Graphics2D g2,
java.awt.Rectangle rect)
Draw the given object.
|
void |
removeDecorator(DisplayDecorator d)
Remove a Decorator from the display
|
public abstract void draw(GridObject obj, java.awt.Component comp, java.awt.Graphics2D g2)
obj
- object we want to drawcomp
- component on which to drawg2
- drawing surfacepublic void draw(GridObject obj, java.awt.Component comp, java.awt.Graphics2D g2, java.awt.Rectangle rect)
draw
in interface GridObjectDisplay
obj
- object we want to drawcomp
- component on which to drawg2
- drawing surfacerect
- rectangle in which to drawpublic void addDecorator(DisplayDecorator d)
d
- The decorator to addpublic void removeDecorator(DisplayDecorator d)
d
- The decorator to removeprotected void adjust(GridObject obj, java.awt.Component comp, java.awt.Graphics2D g2)