API Overview API Index Package Overview Direct link to this page
JDK 1.6
  java.awt. Graphics2D View Source
Author(s)
Jim Graham
Since
Version
1.84, 11/17/05
Serial
Hierarchy
 Object
      Graphics
          Graphics2D
Implements
Subclasses
Description
publicabstract abstract class Graphics2D
  This Graphics2D class extends the Graphics class to provide more sophisticated control over geometry, coordinate transformations, color management, and text layout.
See also:    RenderingHints
Constructors
protected Graphics2D ()
  Constructs a new Graphics2D object.
Methods
Hide/Show inherited methods
publicabstract void addRenderingHints (Map<Object, Object> hints)
  Sets the values of an arbitrary number of preferences for the rendering algorithms.
publicabstract void clearRect (int x, int y, int width, int height) [Inherited From Graphics]
  Clears the specified rectangle by filling it with the background color of the current drawing surface.
publicabstract void clip (Shape s)
  Intersects the current Clip with the interior of the specified Shape and sets the Clip to the resulting intersection.
publicabstract void clipRect (int x, int y, int width, int height) [Inherited From Graphics]
  Intersects the current clip with the specified rectangle.
publicabstract void copyArea (int x, int y, int width, int height, int dx, int dy) [Inherited From Graphics]
  Copies an area of the component by a distance specified by dx and dy.
publicabstract Graphics create () [Inherited From Graphics]
  Creates a new Graphics object that is a copy of this Graphics object.
public Graphics create (int x, int y, int width, int height) [Inherited From Graphics]
  Creates a new Graphics object based on this Graphics object, but with a new translation and clip area.
publicabstract void dispose () [Inherited From Graphics]
  Disposes of this graphics context and releases any system resources that it is using.
publicabstract void draw (Shape s)
  Strokes the outline of a Shape using the settings of the current Graphics2D context.
public void draw3DRect (int x, int y, int width, int height, boolean raised) [Overrides Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  Draws the text given by the specified character array, using this graphics context's current font and color.
publicabstract void drawGlyphVector (GlyphVector g, float x, float y)
  Renders the text of the specified GlyphVector using the Graphics2D context's rendering attributes.
publicabstract void drawImage (BufferedImage img, BufferedImageOp op, int x, int y)
  Renders a BufferedImage that is filtered with a BufferedImageOp.
publicabstract boolean drawImage (Image img, AffineTransform xform, ImageObserver obs)
  Renders an image, applying a transform from image space into user space before drawing.
publicabstract boolean drawImage (Image img, int x, int y, Color bgcolor, ImageObserver observer) [Inherited From Graphics]
  Draws as much of the specified image as is currently available.
publicabstract boolean drawImage (Image img, int x, int y, ImageObserver observer) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  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) [Inherited From Graphics]
  Draws the outline of an oval.
publicabstract void drawPolygon (int[] xPoints, int[] yPoints, int nPoints) [Inherited From Graphics]
  Draws a closed polygon defined by arrays of x and y coordinates.
public void drawPolygon (Polygon p) [Inherited From Graphics]
  Draws the outline of a polygon defined by the specified Polygon object.
publicabstract void drawPolyline (int[] xPoints, int[] yPoints, int nPoints) [Inherited From Graphics]
  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) [Inherited From Graphics]
  Draws the outline of the specified rectangle.
publicabstract void drawRenderableImage (RenderableImage img, AffineTransform xform)
  Renders a RenderableImage, applying a transform from image space into user space before drawing.
publicabstract void drawRenderedImage (RenderedImage img, AffineTransform xform)
  Renders a RenderedImage, applying a transform from image space into user space before drawing.
publicabstract void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight) [Inherited From Graphics]
  Draws an outlined round-cornered rectangle using this graphics context's current color.
publicabstract void drawString (AttributedCharacterIterator iterator, float x, float y)
  Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
publicabstract void drawString (AttributedCharacterIterator iterator, int x, int y) [Specified in Graphics]
  Renders the text of the specified iterator applying its attributes in accordance with the specification of the TextAttribute class.
publicabstract void drawString (String str, float x, float y)
  Renders the text specified by the specified String, using the current text attribute state in the Graphics2D context.
publicabstract void drawString (String str, int x, int y) [Specified in Graphics]
  Renders the text of the specified String, using the current text attribute state in the Graphics2D context.
publicabstract void fill (Shape s)
  Fills the interior of a Shape using the settings of the Graphics2D context.
public void fill3DRect (int x, int y, int width, int height, boolean raised) [Overrides Graphics]
  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) [Inherited From Graphics]
  Fills a circular or elliptical arc covering the specified rectangle.
publicabstract void fillOval (int x, int y, int width, int height) [Inherited From Graphics]
  Fills an oval bounded by the specified rectangle with the current color.
publicabstract void fillPolygon (int[] xPoints, int[] yPoints, int nPoints) [Inherited From Graphics]
  Fills a closed polygon defined by arrays of x and y coordinates.
public void fillPolygon (Polygon p) [Inherited From Graphics]
  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) [Inherited From Graphics]
  Fills the specified rectangle.
publicabstract void fillRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight) [Inherited From Graphics]
  Fills the specified rounded corner rectangle with the current color.
public void finalize () [Inherited From Graphics]
  Disposes of this graphics context once it is no longer referenced.
publicabstract Color getBackground ()
  Returns the background color used for clearing a region.
publicabstract Shape getClip () [Inherited From Graphics]
  Gets the current clipping area.
publicabstract Rectangle getClipBounds () [Inherited From Graphics]
  Returns the bounding rectangle of the current clipping area.
public Rectangle getClipBounds (Rectangle r) [Inherited From Graphics]
  Returns the bounding rectangle of the current clipping area.
@Deprecated
public Rectangle getClipRect () [Inherited From Graphics]
  Returns the bounding rectangle of the current clipping area.
publicabstract Color getColor () [Inherited From Graphics]
  Gets this graphics context's current color.
publicabstract Composite getComposite ()
  Returns the current Composite in the Graphics2D context.
publicabstract GraphicsConfiguration getDeviceConfiguration ()
  Returns the device configuration associated with this Graphics2D.
publicabstract Font getFont () [Inherited From Graphics]
  Gets the current font.
public FontMetrics getFontMetrics () [Inherited From Graphics]
  Gets the font metrics of the current font.
publicabstract FontMetrics getFontMetrics (Font f) [Inherited From Graphics]
  Gets the font metrics for the specified font.
publicabstract FontRenderContext getFontRenderContext ()
  Get the rendering context of the Font within this Graphics2D context.
publicabstract Paint getPaint ()
  Returns the current Paint of the Graphics2D context.
publicabstract Object getRenderingHint (Key hintKey)
  Returns the value of a single preference for the rendering algorithms.
publicabstract RenderingHints getRenderingHints ()
  Gets the preferences for the rendering algorithms.
publicabstract Stroke getStroke ()
  Returns the current Stroke in the Graphics2D context.
publicabstract AffineTransform getTransform ()
  Returns a copy of the current Transform in the Graphics2D context.
publicabstract boolean hit (Rectangle rect, Shape s, boolean onStroke)
  Checks whether or not the specified Shape intersects the specified Rectangle, which is in device space.
public boolean hitClip (int x, int y, int width, int height) [Inherited From Graphics]
  Returns true if the specified rectangular area might intersect the current clipping area.
publicabstract void rotate (double theta)
  Concatenates the current Graphics2D Transform with a rotation transform.
publicabstract void rotate (double theta, double x, double y)
  Concatenates the current Graphics2D Transform with a translated rotation transform.
publicabstract void scale (double sx, double sy)
  Concatenates the current Graphics2D Transform with a scaling transformation Subsequent rendering is resized according to the specified scaling factors relative to the previous scaling.
publicabstract void setBackground (Color color)
  Sets the background color for the Graphics2D context.
publicabstract void setClip (int x, int y, int width, int height) [Inherited From Graphics]
  Sets the current clip to the rectangle specified by the given coordinates.
publicabstract void setClip (Shape clip) [Inherited From Graphics]
  Sets the current clipping area to an arbitrary clip shape.
publicabstract void setColor (Color c) [Inherited From Graphics]
  Sets this graphics context's current color to the specified color.
publicabstract void setComposite (Composite comp)
  Sets the Composite for the Graphics2D context.
publicabstract void setFont (Font font) [Inherited From Graphics]
  Sets this graphics context's font to the specified font.
publicabstract void setPaint (Paint paint)
  Sets the Paint attribute for the Graphics2D context.
publicabstract void setPaintMode () [Inherited From Graphics]
  Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
publicabstract void setRenderingHint (Key hintKey, Object hintValue)
  Sets the value of a single preference for the rendering algorithms.
publicabstract void setRenderingHints (Map<Object, Object> hints)
  Replaces the values of all preferences for the rendering algorithms with the specified hints.
publicabstract void setStroke (Stroke s)
  Sets the Stroke for the Graphics2D context.
publicabstract void setTransform (AffineTransform Tx)
  Overwrites the Transform in the Graphics2D context.
publicabstract void setXORMode (Color c1) [Inherited From Graphics]
  Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
publicabstract void shear (double shx, double shy)
  Concatenates the current Graphics2D Transform with a shearing transform.
public String toString () [Inherited From Graphics]
  Returns a String object representing this Graphics object's value.
publicabstract void transform (AffineTransform Tx)
  Composes an AffineTransform object with the Transform in this Graphics2D according to the rule last-specified-first-applied.
publicabstract void translate (double tx, double ty)
  Concatenates the current Graphics2D Transform with a translation transform.
publicabstract void translate (int x, int y) [Specified in Graphics]
  Translates the origin of the Graphics2D 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