Graphics Class Diagram

 
 

Ancestor class specifications:

java.lang.Object

Graphics Class Specification

            Invariant

                        All drawing performed upon a java.awt.Graphics object...

-       is done relative to the location of the appropriate Container / JComponent. (The upper left corner is treated as (0, 0).)

-       is clipped to the bounding rectangle of the current Container / JComponent.

 

            Drawing Methods

public void setColor( java.awt.Color c )

post:  the current drawing color is set to c

 

public void drawLine( int x1, int y1, int x2, int y2 )

post:  a line segment is drawn from point (x1, y1) to (x2, y2) using the current drawing color

 

public void drawOval( int x, int y, int w, int h )

post:  the outline of an oval is drawn with upper left corner at (x, y), width of w, and height of h using the current drawing color

 

public void drawRect( int x, int y, int w, int h )

post:  the outline of a rectangle is drawn with upper left corner at (x, y), width of w, and height of h using the current drawing color

 

public void drawString( String s, int x, int y )

post:  the text from s is drawn with upper left corner at (x, y) using the current drawing color

 

public void fillOval( int x, int y, int w, int h )

post:  a filled oval is drawn with upper left corner at (x, y), width of w, and height of h using the current drawing color

 

public void fillRect( int x, int y, int w, int h )

post:  a filled rectangle is drawn with upper left corner at (x, y), width of w, and height of h using the current drawing color

 

public void clearRect( int x, int y, int w, int h )

post:  a filled rectangle is drawn with upper left corner at (x, y), width of w, and height of h using the background color of the JComponent