API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. Graphics View Source
Author(s)
Sami Shaio
Arthur van Hoff
Since
JDK1.0
Version
1.74, 02/14/06
Serial
Hierarchy
 Object
      Graphics
Implements
Subclasses
Description
publicabstract abstract class Graphics
  The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images.
Constructors
protected Graphics ()
  Constructs a new Graphics object.
Methods
Hide/Show inherited methods
publicabstract void clearRect (int x, int y, int width, int height)
  Clears the specified rectangle by filling it with the background color of the current drawing surface.
publicabstract void clipRect (int x, int y, int width, int height)
  Intersects the current clip with the specified rectangle.
publicabstract void copyArea (int x, int y, int width, int height, int dx, int dy)
  Copies an area of the component by a distance specified by dx and dy.
publicabstract Graphics create ()
  Creates a new Graphics object that is a copy of this Graphics object.
public Graphics create (int x, int y, int width, int height)
  Creates a new Graphics object based on this Graphics object, but with a new translation and clip area.
publicabstract void dispose ()
  Disposes of this graphics context and releases any system resources that it is using.
public void draw3DRect (int x, int y, int width, int height, boolean raised)
  Draws a 3-D highlighted outline of the specified rectangle.
publicabstract void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle)
  Draws the outline of a circular or elliptical arc covering the specified rectangle.
public void drawBytes (byte[] data, int offset, int length, int x, int y)
  Draws the text given by the specified byte array, using this graphics context's current font and color.
public void drawChars (char[] data, int offset, int length, int x, int y)
  Draws the text given by the specified character array, using this graphics context's current font and color.
publicabstract boolean drawImage (Image img, int x, int y, Color bgcolor, ImageObserver observer)
  Draws as much of the specified image as is currently available.
publicabstract boolean drawImage (Image img, int x, int y, ImageObserver observer)
  Draws as much of the specified image as is currently available.
publicabstract boolean drawImage (Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
  Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
publicabstract boolean drawImage (Image img, int x, int y, int width, int height, ImageObserver observer)
  Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
publicabstract boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
  Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
publicabstract boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
  Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface.
publicabstract void drawLine (int x1, int y1, int x2, int y2)
  Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
publicabstract void drawOval (int x, int y, int width, int height)
  Draws the outline of an oval.
publicabstract void drawPolygon (int[] xPoints, int[] yPoints, int nPoints)
  Draws a closed polygon defined by arrays of x and y coordinates.
public void drawPolygon (Polygon p)
  Draws the outline of a polygon defined by the specified Polygon object.
publicabstract void drawPolyline (int[] xPoints, int[] yPoints, int nPoints)
  Draws a sequence of connected lines defined by arrays of x and y coordinates.
public void drawRect (int x, int y, int width, int height)
  Draws the outline of the specified rectangle.
publicabstract void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight)
  Draws an outlined round-cornered rectangle using this graphics context's current color.
publicabstract void drawString (AttributedCharacterIterator iterator, int x, int y)
  Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
publicabstract void drawString (String str, int x, int y)
  Draws the text given by the specified string, using this graphics context's current font and color.
public void fill3DRect (int x, int y, int width, int height, boolean raised)
  Paints a 3-D highlighted rectangle filled with the current color.
publicabstract void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle)
  Fills a circular or elliptical arc covering the specified rectangle.
publicabstract void fillOval (int x, int y, int width, int height)
  Fills an oval bounded by the specified rectangle with the current color.
publicabstract void fillPolygon (int[] xPoints, int[] yPoints, int nPoints)
  Fills a closed polygon defined by arrays of x and y coordinates.
public void fillPolygon (Polygon p)
  Fills the polygon defined by the specified Polygon object with the graphics context's current color.
publicabstract void fillRect (int x, int y, int width, int height)
  Fills the specified rectangle.
publicabstract void fillRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight)
  Fills the specified rounded corner rectangle with the current color.
public void finalize ()
  Disposes of this graphics context once it is no longer referenced.
publicabstract Shape getClip ()
  Gets the current clipping area.
publicabstract Rectangle getClipBounds ()
  Returns the bounding rectangle of the current clipping area.
public Rectangle getClipBounds (Rectangle r)
  Returns the bounding rectangle of the current clipping area.
@Deprecated
public Rectangle getClipRect ()
  Returns the bounding rectangle of the current clipping area.
publicabstract Color getColor ()
  Gets this graphics context's current color.
publicabstract Font getFont ()
  Gets the current font.
public FontMetrics getFontMetrics ()
  Gets the font metrics of the current font.
publicabstract FontMetrics getFontMetrics (Font f)
  Gets the font metrics for the specified font.
public boolean hitClip (int x, int y, int width, int height)
  Returns true if the specified rectangular area might intersect the current clipping area.
publicabstract void setClip (int x, int y, int width, int height)
  Sets the current clip to the rectangle specified by the given coordinates.
publicabstract void setClip (Shape clip)
  Sets the current clipping area to an arbitrary clip shape.
publicabstract void setColor (Color c)
  Sets this graphics context's current color to the specified color.
publicabstract void setFont (Font font)
  Sets this graphics context's font to the specified font.
publicabstract void setPaintMode ()
  Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
publicabstract void setXORMode (Color c1)
  Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
public String toString ()
  Returns a String object representing this Graphics object's value.
publicabstract void translate (int x, int y)
  Translates the origin of the graphics context to the point (xy) in the current coordinate system.
Fields
Hide/Show inherited fields
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar