|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavalib.worldcanvas.MyCanvas
public abstract class MyCanvas
Abstract Canvas - allows the drawing of shapes, lines, and text in the window of the given size, window closing and re-opening.
Field Summary | |
---|---|
protected int |
height
the height of the panel |
protected int |
width
the width of the panel |
Constructor Summary | |
---|---|
MyCanvas(int width,
int height)
Construct a MyCanvas with the given
width and height. |
Method Summary | |
---|---|
abstract void |
clear()
Clear the canvas before painting the next scene |
abstract boolean |
drawImage(ImageMaker image,
Posn nw)
Draw the image provided by the
on the at the given
NW corner |
abstract boolean |
drawImage(String fileName,
Posn nw)
Draw the image in the specified file at the location of the given NW corner |
abstract boolean |
drawImage(WorldImage image)
Draw the image on the at its
pinhole location. |
abstract Graphics2D |
getBufferGraphics()
Returns a Graphics2D object that permits
painting to the internal buffered image for this canvas. |
String |
toIndentedString(String indent)
Produce an indented String representation of this Canvas |
String |
toString()
Produce a String representation of this Canvas |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int height
protected int width
Constructor Detail |
---|
public MyCanvas(int width, int height)
Construct a MyCanvas
with the given
width and height.
width
- the width of the panelheight
- the height of the panelMethod Detail |
---|
public abstract void clear()
public abstract boolean drawImage(ImageMaker image, Posn nw)
ImageMaker
on the Canvas
at the given
NW corner
image
- the image maker for the image filenw
- the NW corner for the image placementpublic abstract boolean drawImage(String fileName, Posn nw)
fileName
- the name of the image filenw
- the NW corner for the image placementpublic abstract boolean drawImage(WorldImage image)
Canvas
at its
pinhole location.
image
- the image to be drawn
true
public abstract Graphics2D getBufferGraphics()
Returns a Graphics2D
object that permits
painting to the internal buffered image for this canvas.
public String toIndentedString(String indent)
String
representation of this Canvas
indent
- the desired indentation: ignored, because we only produce
one line of text.public String toString()
String
representation of this Canvas
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |