|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectCanvas
public class Canvas
Class Canvas - a class to allow for simple graphical drawing on a canvas. ---> This is the primitives-free version of Canvas! <---
| Nested Class Summary | |
|---|---|
protected class |
Canvas.CanvasPane
Nested class CanvasPane - the actual canvas component contained in the Canvas frame. |
| Field Summary | |
|---|---|
protected Canvas.CanvasPane |
canvas
|
| Constructor Summary | |
|---|---|
Canvas()
Create a Canvas with default title, height, width and background color ("Canvas", 300, 300, white). |
|
Canvas(String title)
Create a Canvas with default height, width and background color (300, 300, white). |
|
| Method Summary | |
|---|---|
void |
drawFilledOval(Integer x,
Integer y,
Integer width,
Integer height)
Draws a filled oval on the Canvas. |
void |
drawFilledPolygon(Integer[] xs,
Integer[] ys,
Integer size)
Draws a filled polygon on the Canvas. |
void |
drawFilledRectangle(Integer x,
Integer y,
Integer width,
Integer height)
Draws a filled rectangle on the Canvas. |
void |
drawLine(Integer x1,
Integer y1,
Integer x2,
Integer y2)
Draws a line on the Canvas. |
void |
drawOval(Integer x,
Integer y,
Integer width,
Integer height)
Draws an oval on the Canvas. |
void |
drawPolygon(Integer[] xs,
Integer[] ys,
Integer size)
Draws a polygon on the Canvas. |
void |
drawRectangle(Integer x,
Integer y,
Integer width,
Integer height)
Draws a rectangle on the Canvas. |
void |
drawString(String text,
Integer x,
Integer y)
Draws a String on the Canvas. |
void |
erase()
Erase the whole canvas. |
void |
eraseFilledOval(Integer x,
Integer y,
Integer width,
Integer height)
Erases a filled oval on the Canvas. |
void |
eraseFilledRectangle(Integer x,
Integer y,
Integer width,
Integer height)
Erases a filled rectangle on the Canvas. |
void |
eraseOval(Integer x,
Integer y,
Integer width,
Integer height)
Erases an oval on the Canvas. |
void |
eraseRectangle(Integer x,
Integer y,
Integer width,
Integer height)
Erases a rectangle on the Canvas. |
void |
eraseString(String text,
Integer x,
Integer y)
Erases a String on the Canvas. |
void |
fillBackground(java.awt.Color newColor)
Fills in the Canvas (background) with the specified color. |
java.awt.Font |
getFont()
Returns the current font of the canvas. |
java.awt.Color |
getInkColor()
Returns the current pen color. |
Boolean |
isVisible()
Provide information on visibility of the Canvas. |
void |
pause(Integer milliseconds)
Waits for a specified number of milliseconds before finishing. |
void |
setFont(java.awt.Font newFont)
changes the current Font used on the Canvas |
void |
setFontSize(Integer newSize)
Sets the point size of the current font to the specified value. |
void |
setInkColor(java.awt.Color newColor)
Sets the "pen" (outline) color for the Canvas. |
void |
setSize(Integer width,
Integer height)
Sets the size of the canvas. |
void |
setVisible(Boolean visible)
Set the canvas visibility and brings canvas to the front of screen when made visible. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Canvas.CanvasPane canvas
| Constructor Detail |
|---|
public Canvas(String title)
title - title to appear in Canvas Framepublic Canvas()
| Method Detail |
|---|
public void setInkColor(java.awt.Color newColor)
newColor - The color to which to set the pen/drawing tool.public java.awt.Color getInkColor()
public void setVisible(Boolean visible)
visible - Boolean value representing the desired visibility of
the canvas (true or false)public Boolean isVisible()
public void erase()
public void drawString(String text,
Integer x,
Integer y)
text - the String to be displayedx - x coordinate for text placementy - y coordinate for text placement
public void eraseString(String text,
Integer x,
Integer y)
text - the String to be displayedx - x coordinate for text placementy - y coordinate for text placement
public void drawLine(Integer x1,
Integer y1,
Integer x2,
Integer y2)
x1 - x coordinate of start of liney1 - y coordinate of start of linex2 - x coordinate of end of liney2 - y coordinate of end of line
public void drawRectangle(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void drawFilledRectangle(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void drawPolygon(Integer[] xs,
Integer[] ys,
Integer size)
xs - array of x coordinates of polygon pointsys - array of y coordinates of polygon pointssize - the number of points (vertices) in the polygon
public void drawFilledPolygon(Integer[] xs,
Integer[] ys,
Integer size)
xs - array of x coordinates of polygon pointsys - array of y coordinates of polygon pointssize - the number of points (vertices) in the polygon
public void eraseRectangle(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void eraseFilledRectangle(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void drawOval(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void drawFilledOval(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void eraseOval(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - height
public void eraseFilledOval(Integer x,
Integer y,
Integer width,
Integer height)
x - x coordinate of top left cornery - y coordinate of top left cornerwidth - widthheight - heightpublic void fillBackground(java.awt.Color newColor)
newColor - the new color for the background of the Canvaspublic void setFont(java.awt.Font newFont)
newFont - new font to be used for String outputpublic java.awt.Font getFont()
public void setFontSize(Integer newSize)
newSize - the new point size
public void setSize(Integer width,
Integer height)
width - new widthheight - new heightpublic void pause(Integer milliseconds)
milliseconds - the number
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||