Java Reference
In-Depth Information
Graphics
Package: java.awt
Ancestor classes:
Object
|
+--Graphics
Graphics is an abstract class.
Although many of these methods are abstract, we always use them with objects of a concrete
descendent class of Graphics , even though we usually do not know the name of that
concrete class.
public abstract void drawRect( int x, int y,
int width, int height)
Draws the outline of the specifi ed rectangle. ( x , y ) is the location of the upper-left corner of
the rectangle.
public abstract void fillRect( int x, int y,
int width, int height)
Fills the specifi ed rectangle. ( x , y ) is the location of the upper-left corner of the rectangle.
public void draw3DRect( int x, int y, int width,
int height, boolean raised)
Draws the outline of the specifi ed rectangle. ( x , y ) is the location of the upper-left corner.The
rectangle is highlighted to look like it has thickness. If raised is true , the highlight makes
the rectangle appear to stand out from the background. If raised is false , the highlight makes
the rectangle appear to be sunken into the background.
public void fill3DRect( int x, int y, int width,
int height, boolean raised)
Fills the rectangle specifi ed by
draw3DRec(x, y,width, height, raised)
public abstract void drawArc( int x, int y,
int width, int height,
int startAngle, int arcSweep)
Draws part of an oval that just fi ts into an invisible rectangle described by the fi rst four
arguments. The portion of the oval drawn is given by the last two arguments. See Chapter 18
for details.
public abstract void drawLine( int x1, int y1, int x2, int y2)
Draws a line between points ( x1 , y1 ) and ( x2 , y2 ).
public abstract void drawOval( int x, int y,
int width, int height)
Draws the outline of the oval with the smallest enclosing rectangle that has the specifi ed width
and height. The (imagined) rectangle has its upper-left corner located at ( x , y ).
 
Search WWH ::




Custom Search