The Graphics class is an abstract class that represents an object on which you can draw. The concrete classes that are actually used to represent graphics objects are platform dependent, but because they extend the Graphics class, must implement the methods here.
public abstract class java.awt.Graphics extends java.lang.Object { // Constructors protected Graphics(); // Instance Methods public abstract void clearRect (int x, int y, int width, int height); public abstract void clipRect (int x, int y, int width, int height); public abstract void copyArea (int x, int y, int width, int height, int deltax, int deltay); public abstract Graphics create(); public Graphics create (int x, int y, int width, int height); public abstract void dispose(); public void draw3DRect (int x, int y, int width, int height, boolean raised); public abstract void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle); public void drawBytes (byte text[], int offset, int length, int x, int y); public void drawChars (char text[], int offset, int length, int x, int y); public abstract boolean drawImage (Image image, int x, int y, ImageObserver observer); public abstract boolean drawImage (Image image, int x, int y, int width, int height, ImageObserver observer); public abstract boolean drawImage (Image image, int x, int y, Color backgroundColor, ImageObserver observer); public abstract boolean drawImage (Image image, int x, int y, int width, int height, Color backgroundColor, ImageObserver observer); public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer); public abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer); public abstract void drawLine (int x1, int y1, int x2, int y2); public abstract void drawOval (int x, int y, int width, int height); public abstract void drawPolygon (int xPoints[], int yPoints[], int numPoints); public void drawPolygon (Polygon p); public abstract void drawPolyline(int[ ] xPoints, int[ ] yPoints, int nPoints); public void drawRect (int x, int y, int width, int height); public abstract void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight); public abstract void drawString (String text, int x, int y); public void fill3DRect (int x, int y, int width, int height, boolean raised); public abstract void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle); public abstract void fillOval (int x, int y, int width, int height); public abstract void fillPolygon (int xPoints[], int yPoints[], int numPoints); public void fillPolygon (Polygon p); public abstract void fillRect (int x, int y, int width, int height); public abstract void fillRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight); public void finalize(); public abstract Shape getClip(); public abstract Rectangle getClipBounds(); public abstract Rectangle getClipRect(); public abstract Color getColor(); public abstract Font getFont(); public FontMetrics getFontMetrics(); public abstract FontMetrics getFontMetrics (Font font); public abstract void setClip (int x, int y, int width, int height); public abstract void setClip (Shape clip); public abstract void setColor (Color color); public abstract void setFont (Font font); public abstract void setPaintMode(); public abstract void setXORMode (Color xorColor); public String toString(); public abstract void translate (int x, int y); }
Called by constructors of platform specific subclasses.
x coordinate of origin of area to clear.
y coordinate of origin of area to clear.
size in horizontal direction to clear.
size in vertical direction to clear.
Resets a rectangular area to the background color.
x coordinate of origin of clipped area.
y coordinate of origin of clipped area.
size in horizontal direction to clip.
size in vertical direction to clip.
Reduces the drawing area to the intersection of the current drawing area and the rectangular area defined by x, y, width, and height.
x coordinate of origin of area to copy.
y coordinate of origin of area to copy.
size in horizontal direction to copy.
size in vertical direction to copy.
offset in horizontal direction to copy area to.
offset in vertical direction to copy area to.
Copies a rectangular area to a new area, whose top left corner is (x+deltax, y+deltay).
New graphics context.
Creates a second reference to the same graphics context.
x coordinate of origin of new graphics context.
y coordinate of origin of new graphics context.
size in horizontal direction.
size in vertical direction.
New graphics context
Creates a second reference to a subset of the same graphics context.
Frees system resources used by graphics context.
x coordinate of the rectangle origin.
y coordinate of the rectangle origin
Width of the rectangle to draw.
Height of the rectangle to draw.
Determines if rectangle drawn is raised or not; true for a raised rectangle.
Draws an unfilled 3-D rectangle from (x, y) of size width x height.
x coordinate of the bounding rectangle's origin.
y coordinate of the bounding rectangle's origin
Width of the bounding rectangle for the arc.
Height of the bounding rectangle for the arc.
Angle at which arc begins, in degrees
length of arc, in degrees
Draws an unfilled arc from startAngle to arcAngle within bounding rectangle from (x, y) of size width x height. Zero degrees is at three o'clock; positive angles are counter clockwise.
Text to draw, as a byte array.
Starting position within text to draw.
Number of bytes to draw.
x coordinate of baseline origin.
y coordinate of baseline origin.
If offset or length is invalid.
Draws text on screen, starting with text[offset] and ending with text[offset+length-1].
Text to draw, as a char array.
Starting position within text to draw.
Number of bytes to draw.
x coordinate of baseline origin.
y coordinate of baseline origin.
If offset or length is invalid.
Draws text on screen, starting with text[offset] and ending with text[offset+length-1].
Image to draw.
x coordinate of image origin.
y coordinate of image origin.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws image to screen at (x, y), at its original size. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information made available.
Image to draw.
x coordinate of image origin.
y coordinate of image origin.
New image size in horizontal direction.
New image size in vertical direction.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws image to screen at (x, y), scaled to width x height. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information made available.
Image to draw.
x coordinate of image origin.
y coordinate of image origin.
Color to show through image where transparent.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws image to screen at (x, y), at its original size. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information made available. The background color is visible through any transparent pixels.
Image to draw.
x coordinate of image origin.
y coordinate of image origin.
New image size in horizontal direction.
New image size in vertical direction.
Color to show through image where transparent.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws image to screen at (x, y), scaled to width x height. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information made available. The background color is visible through any transparent pixels.
Image to draw.
x coordinate of one corner of destination (device) rectangle.
y coordinate of one corner of destination (device) rectangle.
x coordinate of the opposite corner of destination (device) rectangle.
y coordinate of the opposite corner of destination (device) rectangle.
x coordinate of one corner of source (image) rectangle.
y coordinate of one corner of source (image) rectangle.
x coordinate of the opposite corner of source (image) rectangle.
y coordinate of the opposite corner of source (image) rectangle.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws the part of image described by dx1, dy1, dx2, and dy2 to the screen into the rectangle described by sx1, sy1, sx2, and sy2. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information is made available.
Image to draw.
x coordinate of one corner of destination (device) rectangle.
y coordinate of one corner of destination (device) rectangle.
x coordinate of the opposite corner of destination (device) rectangle.
y coordinate of the opposite corner of destination (device) rectangle.
x coordinate of one corner of source (image) rectangle.
y coordinate of one corner of source (image) rectangle.
x coordinate of the opposite corner of source (image) rectangle.
y coordinate of the opposite corner of source (image) rectangle.
Color to show through image where transparent.
Object that watches for image information; almost always this.
true if the image has fully loaded when the method returns, false otherwise.
Draws the part of image described by dx1, dy1, dx2, and dy2 to the screen into the rectangle described by sx1, sy1, sx2, and sy2. Drawing may be asynchronous. If image is not fully loaded when the method returns, observer is notified when additional information made available. The background color is visible through any transparent pixels.
x coordinate of one point on line.
y coordinate of one point on line.
x coordinate of the opposite point on line.
y coordinate of the opposite point on line.
Draws a line connecting (x1, y1) and (x2, y2).
x coordinate of bounding rectangle origin.
y coordinate of bounding rectangle origin
Width of bounding rectangle to draw in.
Height of bounding rectangle to draw in.
Draws an unfilled oval within bounding rectangle from (x, y) of size width x height.
The array of x coordinates for each point.
The array of y coordinates for each point.
The number of elements in both xPoints and yPoints arrays to use.
Draws an unfilled polygon based on first numPoints elements in xPoints and yPoints.
Points of object to draw.
Draws an unfilled polygon based on points within the Polygon p.
The array of x coordinates for each point.
The array of y coordinates for each point.
The number of elements in both xPoints and yPoints arrays to use.
Draws a series of line segments based on first numPoints elements in xPoints and yPoints.
x coordinate of rectangle origin.
y coordinate of rectangle origin
Width of rectangle to draw.
Height of rectangle to draw.
Draws an unfilled rectangle from (x, y) of size width x height.
x coordinate of bounding rectangle origin.
y coordinate of bounding rectangle origin
Width of rectangle to draw.
Height of rectangle to draw.
Width of arc of rectangle corner.
Height of arc of rectangle corner.
Draws an unfilled rectangle from (x, y) of size width x height with rounded corners.
Text to draw.
x coordinate of baseline origin.
y coordinate of baseline origin.
Draws text on screen.
x coordinate of rectangle origin.
y coordinate of rectangle origin
Width of rectangle to draw.
Height of rectangle to draw.
true to draw a rectangle that appears raised; false to draw a rectangle that appears depressed.
Draws a filled 3-D rectangle from (x, y) of size width x height.
x coordinate of bounding rectangle origin.
y coordinate of bounding rectangle origin
Width of bounding rectangle to draw in.
Height of bounding rectangle to draw in.
Starting angle of arc.
The extent of the arc, measured from startAngle
Draws a filled arc from startAngle to arcAngle within bounding rectangle from (x, y) of size width x height. Zero degrees is at three o'clock; positive angles are counter clockwise.
x coordinate of bounding rectangle origin.
y coordinate of bounding rectangle origin
Width of bounding rectangle to draw in.
Height of bounding rectangle to draw in.
Draws filled oval within bounding rectangle from (x, y) of size width x height.
The array of x coordinates for each point.
The array of y coordinates for each point.
The number of elements in both xPoints and yPoints arrays to use.
If numPoints > xPoints.length or numPoints > yPoints.length.
Draws filled polygon based on first numPoints elements in xPoints and yPoints.
Points of object to draw.
Draws filled polygon based on points within the Polygon p.
x coordinate of rectangle origin.
y coordinate of rectangle origin
Width of rectangle to draw.
Height of rectangle to draw.
Draws filled rectangle from (x, y) of size width x height.
x coordinate of bounding rectangle origin.
y coordinate of bounding rectangle origin
Width of rectangle to draw.
Height of rectangle to draw.
Width of arc of rectangle corner.
Height of arc of rectangle corner.
Draws a filled rectangle from (x, y) of size width x height with rounded corners.
Object.finalize()
Tells the garbage collector to dispose of graphics context.
Shape describing the clipping are of the graphics context.
Rectangle describing the clipping area of the graphics context.
Replaced by getClipBounds().
The current drawing Color of the graphics context.
The current Font of the graphics context.
The FontMetrics of the current font of the graphics context.
Font to get metrics for.
The FontMetrics of the given font for the graphics context.
x coordinate of rectangle
y coordinate of rectangle
width of rectangle
height of rectangle
Changes current clipping region to the specified rectangle.
The new clipping shape.
Changes current clipping region to the specified shape.
New color.
Changes current drawing color of graphics context.
New font.
Changes current font of graphics context.
Changes painting mode to normal mode.
XOR mode drawing color.
Changes painting mode to XOR mode; in this mode, drawing the same object in the same color at the same location twice has no net effect.
A string representation of the Graphics object.
Object.toString()
x coordinate of new drawing origin.
y coordinate of new drawing origin.
Moves the origin of drawing operations to (x, y).
Color, Font, FontMetrics, Image, ImageObserver, Object, Polygon, Rectangle, Shape, String
This HTML Help has been published using the chm2web software. |