|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.gui.Painter
public abstract class Painter
Abstract class for local and remote painting objects that do the actual work of getting Displayables to paint themselves. Used by DisplaySurface.
LocalPainter| Field Summary | |
|---|---|
protected java.awt.Color |
bgColor
|
protected java.awt.image.BufferedImage |
buffImage
|
protected java.util.ArrayList |
displayables
|
protected java.awt.Graphics2D |
g2
|
protected int |
height
|
protected java.util.ArrayList |
orderedDisplayables
|
protected float |
origHeight
|
protected float |
origWidth
|
protected SimGraphics |
simGraphics
|
protected DisplaySurface |
surface
|
protected java.awt.Toolkit |
toolkit
|
protected int |
width
|
| Constructor Summary | |
|---|---|
Painter()
Creates a Painter. |
|
Painter(DisplaySurface s,
int w,
int h)
Creates a Painter using the specified displaySurface, and with the specified width and height. |
|
| Method Summary | |
|---|---|
void |
addDisplayable(Displayable d)
Adds a Displayable to the list of displayables to be displayed. |
void |
addDisplayable(DisplaySurface.DisplayableOrder displayableOrder)
Addes a displayable order to the list of ordered displayables. |
protected void |
createBufferedImage()
Creates a BufferedImage for use by sub class painters. |
protected void |
createGraphics2D()
Creates and sets the drawing context. |
void |
dispose()
Disposes of the graphics object |
abstract void |
drawRect(java.awt.Graphics g,
int left,
int top,
int width,
int height)
|
abstract void |
eraseRect(java.awt.Graphics g)
|
void |
finalize()
|
java.awt.Image |
getCurrentImage()
Gets the current BufferedImage |
java.awt.Graphics2D |
getGraphics()
Gets the graphics context on which to draw. |
void |
init(DisplaySurface s,
int w,
int h)
Associates this Painter with the specified DisplaySurface and initializes the width and height. |
abstract void |
paint(java.awt.Graphics g)
Paints the displayables. |
protected void |
paintBackground()
Paints the background to the currently specified color. |
void |
removeDisplayable(Displayable d)
Removes a Displayable to the list of displayables to be displayed. |
void |
reSize(int newWidth,
int newHeight)
Resizes the buffered image on which all drawing is done to the specified newWidth and height |
void |
setBackgroundColor(java.awt.Color c)
Sets the background color. |
abstract void |
takeSnapshot(java.io.DataOutputStream os)
Takes a snapshot of the current screen image. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.ArrayList orderedDisplayables
protected DisplaySurface surface
protected java.awt.image.BufferedImage buffImage
protected java.awt.Graphics2D g2
protected int width
protected int height
protected float origWidth
protected float origHeight
protected java.util.ArrayList displayables
protected SimGraphics simGraphics
protected java.awt.Toolkit toolkit
protected java.awt.Color bgColor
| Constructor Detail |
|---|
public Painter()
public Painter(DisplaySurface s,
int w,
int h)
s - the displaySurface associated with this Painterw - the width of the painterh - the height of the painter| Method Detail |
|---|
public void init(DisplaySurface s,
int w,
int h)
s - the displaySurface associated with this Painterw - the width of the painterh - the height of the painterprotected void createBufferedImage()
public void reSize(int newWidth,
int newHeight)
newWidth - the newWidth of the new buffered imagenewHeight - the height of the new buffered imageprotected void createGraphics2D()
public void addDisplayable(Displayable d)
d - the displayable to addpublic void addDisplayable(DisplaySurface.DisplayableOrder displayableOrder)
displayableOrder - the DisplayableOrder to addpublic void removeDisplayable(Displayable d)
d - the displayable to removepublic java.awt.Graphics2D getGraphics()
public abstract void paint(java.awt.Graphics g)
public abstract void drawRect(java.awt.Graphics g,
int left,
int top,
int width,
int height)
public abstract void eraseRect(java.awt.Graphics g)
public void finalize()
finalize in class java.lang.Objectpublic void dispose()
public void setBackgroundColor(java.awt.Color c)
protected void paintBackground()
public abstract void takeSnapshot(java.io.DataOutputStream os)
public java.awt.Image getCurrentImage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||