java.awt
Class Graphics

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.Graphics
Direct Known Subclasses:
DebugGraphics sample code for javax.swing.DebugGraphics definition code for javax.swing.DebugGraphics , Graphics2D sample code for java.awt.Graphics2D definition code for java.awt.Graphics2D

public abstract class Graphics
extends Object sample code for java.lang.Object definition code for java.lang.Object

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.

A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties:

Coordinates are infinitely thin and lie between the pixels of the output device. Operations that draw the outline of a figure operate by traversing an infinitely thin path between pixels with a pixel-sized pen that hangs down and to the right of the anchor point on the path. Operations that fill a figure operate by filling the interior of that infinitely thin path. Operations that render horizontal text render the ascending portion of character glyphs entirely above the baseline coordinate.

The graphics pen hangs down and to the right from the path it traverses. This has the following implications:

All coordinates that appear as arguments to the methods of this Graphics object are considered relative to the translation origin of this Graphics object prior to the invocation of the method.

All rendering operations modify only pixels which lie within the area bounded by the current clip, which is specified by a Shape sample code for java.awt.Shape definition code for java.awt.Shape in user space and is controlled by the program using the Graphics object. This user clip is transformed into device space and combined with the device clip, which is defined by the visibility of windows and device extents. The combination of the user clip and device clip defines the composite clip, which determines the final clipping region. The user clip cannot be modified by the rendering system to reflect the resulting composite clip. The user clip can only be changed through the setClip or clipRect methods. All drawing or writing is done in the current color, using the current paint mode, and in the current font.

Since:
JDK1.0
See Also:
Component sample code for java.awt.Component definition code for java.awt.Component , clipRect(int, int, int, int) sample code for java.awt.Graphics.clipRect(int, int, int, int) definition code for java.awt.Graphics.clipRect(int, int, int, int) , setColor(java.awt.Color) sample code for java.awt.Graphics.setColor(java.awt.Color) definition code for java.awt.Graphics.setColor(java.awt.Color) , setPaintMode() sample code for java.awt.Graphics.setPaintMode() definition code for java.awt.Graphics.setPaintMode() , setXORMode(java.awt.Color) sample code for java.awt.Graphics.setXORMode(java.awt.Color) definition code for java.awt.Graphics.setXORMode(java.awt.Color) , setFont(java.awt.Font) sample code for java.awt.Graphics.setFont(java.awt.Font) definition code for java.awt.Graphics.setFont(java.awt.Font)

Constructor Summary
protected Graphics sample code for java.awt.Graphics.Graphics() definition code for java.awt.Graphics.Graphics() ()
          Constructs a new Graphics object.
 
Method Summary
abstract  void clearRect sample code for java.awt.Graphics.clearRect(int, int, int, int) definition code for java.awt.Graphics.clearRect(int, int, int, int) (int x, int y, int width, int height)
          Clears the specified rectangle by filling it with the background color of the current drawing surface.
abstract  void clipRect sample code for java.awt.Graphics.clipRect(int, int, int, int) definition code for java.awt.Graphics.clipRect(int, int, int, int) (int x, int y, int width, int height)
          Intersects the current clip with the specified rectangle.
abstract  void copyArea sample code for java.awt.Graphics.copyArea(int, int, int, int, int, int) definition code for java.awt.Graphics.copyArea(int, int, int, int, int, int) (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.
abstract  Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics create sample code for java.awt.Graphics.create() definition code for java.awt.Graphics.create() ()
          Creates a new Graphics object that is a copy of this Graphics object.
 Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics create sample code for java.awt.Graphics.create(int, int, int, int) definition code for java.awt.Graphics.create(int, int, int, int) (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.
abstract  void dispose sample code for java.awt.Graphics.dispose() definition code for java.awt.Graphics.dispose() ()
          Disposes of this graphics context and releases any system resources that it is using.
 void draw3DRect sample code for java.awt.Graphics.draw3DRect(int, int, int, int, boolean) definition code for java.awt.Graphics.draw3DRect(int, int, int, int, boolean) (int x, int y, int width, int height, boolean raised)
          Draws a 3-D highlighted outline of the specified rectangle.
abstract  void drawArc sample code for java.awt.Graphics.drawArc(int, int, int, int, int, int) definition code for java.awt.Graphics.drawArc(int, int, int, int, int, int) (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.
 void drawBytes sample code for java.awt.Graphics.drawBytes(byte[], int, int, int, int) definition code for java.awt.Graphics.drawBytes(byte[], int, int, int, int) (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.
 void drawChars sample code for java.awt.Graphics.drawChars(char[], int, int, int, int) definition code for java.awt.Graphics.drawChars(char[], int, int, int, int) (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.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, java.awt.Color, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, java.awt.Color, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, Color sample code for java.awt.Color definition code for java.awt.Color  bgcolor, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver  observer)
          Draws as much of the specified image as is currently available.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver  observer)
          Draws as much of the specified image as is currently available.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, int width, int height, Color sample code for java.awt.Color definition code for java.awt.Color  bgcolor, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver  observer)
          Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, int width, int height, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver  observer)
          Draws as much of the specified image as has already been scaled to fit inside the specified rectangle.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.Color, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color sample code for java.awt.Color definition code for java.awt.Color  bgcolor, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.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.
abstract  boolean drawImage sample code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver) definition code for java.awt.Graphics.drawImage(java.awt.Image, int, int, int, int, int, int, int, int, java.awt.image.ImageObserver) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.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.
abstract  void drawLine sample code for java.awt.Graphics.drawLine(int, int, int, int) definition code for java.awt.Graphics.drawLine(int, int, int, int) (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.
abstract  void drawOval sample code for java.awt.Graphics.drawOval(int, int, int, int) definition code for java.awt.Graphics.drawOval(int, int, int, int) (int x, int y, int width, int height)
          Draws the outline of an oval.
abstract  void drawPolygon sample code for java.awt.Graphics.drawPolygon(int[], int[], int) definition code for java.awt.Graphics.drawPolygon(int[], int[], int) (int[] xPoints, int[] yPoints, int nPoints)
          Draws a closed polygon defined by arrays of x and y coordinates.
 void drawPolygon sample code for java.awt.Graphics.drawPolygon(java.awt.Polygon) definition code for java.awt.Graphics.drawPolygon(java.awt.Polygon) (Polygon sample code for java.awt.Polygon definition code for java.awt.Polygon  p)
          Draws the outline of a polygon defined by the specified Polygon object.
abstract  void drawPolyline sample code for java.awt.Graphics.drawPolyline(int[], int[], int) definition code for java.awt.Graphics.drawPolyline(int[], int[], int) (int[] xPoints, int[] yPoints, int nPoints)
          Draws a sequence of connected lines defined by arrays of x and y coordinates.
 void drawRect sample code for java.awt.Graphics.drawRect(int, int, int, int) definition code for java.awt.Graphics.drawRect(int, int, int, int) (int x, int y, int width, int height)
          Draws the outline of the specified rectangle.
abstract  void drawRoundRect sample code for java.awt.Graphics.drawRoundRect(int, int, int, int, int, int) definition code for java.awt.Graphics.drawRoundRect(int, int, int, int, int, int) (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.
abstract  void drawString sample code for java.awt.Graphics.drawString(java.text.AttributedCharacterIterator, int, int) definition code for java.awt.Graphics.drawString(java.text.AttributedCharacterIterator, int, int) (AttributedCharacterIterator sample code for java.text.AttributedCharacterIterator definition code for java.text.AttributedCharacterIterator  iterator, int x, int y)
          Draws the text given by the specified iterator, using this graphics context's current color.
abstract  void drawString sample code for java.awt.Graphics.drawString(java.lang.String, int, int) definition code for java.awt.Graphics.drawString(java.lang.String, int, int) (String sample code for java.lang.String definition code for java.lang.String  str, int x, int y)
          Draws the text given by the specified string, using this graphics context's current font and color.
 void fill3DRect sample code for java.awt.Graphics.fill3DRect(int, int, int, int, boolean) definition code for java.awt.Graphics.fill3DRect(int, int, int, int, boolean) (int x, int y, int width, int height, boolean raised)
          Paints a 3-D highlighted rectangle filled with the current color.
abstract  void fillArc sample code for java.awt.Graphics.fillArc(int, int, int, int, int, int) definition code for java.awt.Graphics.fillArc(int, int, int, int, int, int) (int x, int y, int width, int height, int startAngle, int arcAngle)
          Fills a circular or elliptical arc covering the specified rectangle.
abstract  void fillOval sample code for java.awt.Graphics.fillOval(int, int, int, int) definition code for java.awt.Graphics.fillOval(int, int, int, int) (int x, int y, int width, int height)
          Fills an oval bounded by the specified rectangle with the current color.
abstract  void fillPolygon sample code for java.awt.Graphics.fillPolygon(int[], int[], int) definition code for java.awt.Graphics.fillPolygon(int[], int[], int) (int[] xPoints, int[] yPoints, int nPoints)
          Fills a closed polygon defined by arrays of x and y coordinates.
 void fillPolygon sample code for java.awt.Graphics.fillPolygon(java.awt.Polygon) definition code for java.awt.Graphics.fillPolygon(java.awt.Polygon) (Polygon sample code for java.awt.Polygon definition code for java.awt.Polygon  p)
          Fills the polygon defined by the specified Polygon object with the graphics context's current color.
abstract  void fillRect sample code for java.awt.Graphics.fillRect(int, int, int, int) definition code for java.awt.Graphics.fillRect(int, int, int, int) (int x, int y, int width, int height)
          Fills the specified rectangle.
abstract  void fillRoundRect sample code for java.awt.Graphics.fillRoundRect(int, int, int, int, int, int) definition code for java.awt.Graphics.fillRoundRect(int, int, int, int, int, int) (int x, int y, int width, int height, int arcWidth, int arcHeight)
          Fills the specified rounded corner rectangle with the current color.
 void finalize sample code for java.awt.Graphics.finalize() definition code for java.awt.Graphics.finalize() ()
          Disposes of this graphics context once it is no longer referenced.
abstract  Shape sample code for java.awt.Shape definition code for java.awt.Shape getClip sample code for java.awt.Graphics.getClip() definition code for java.awt.Graphics.getClip() ()
          Gets the current clipping area.
abstract  Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getClipBounds sample code for java.awt.Graphics.getClipBounds() definition code for java.awt.Graphics.getClipBounds() ()
          Returns the bounding rectangle of the current clipping area.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getClipBounds sample code for java.awt.Graphics.getClipBounds(java.awt.Rectangle) definition code for java.awt.Graphics.getClipBounds(java.awt.Rectangle) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  r)
          Returns the bounding rectangle of the current clipping area.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getClipRect sample code for java.awt.Graphics.getClipRect() definition code for java.awt.Graphics.getClipRect() ()
          Deprecated. As of JDK version 1.1, replaced by getClipBounds().
abstract  Color sample code for java.awt.Color definition code for java.awt.Color getColor sample code for java.awt.Graphics.getColor() definition code for java.awt.Graphics.getColor() ()
          Gets this graphics context's current color.
abstract  Font sample code for java.awt.Font definition code for java.awt.Font getFont sample code for java.awt.Graphics.getFont() definition code for java.awt.Graphics.getFont() ()
          Gets the current font.
 FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics getFontMetrics sample code for java.awt.Graphics.getFontMetrics() definition code for java.awt.Graphics.getFontMetrics() ()
          Gets the font metrics of the current font.
abstract  FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics getFontMetrics sample code for java.awt.Graphics.getFontMetrics(java.awt.Font) definition code for java.awt.Graphics.getFontMetrics(java.awt.Font) (Font sample code for java.awt.Font definition code for java.awt.Font  f)
          Gets the font metrics for the specified font.
 boolean hitClip sample code for java.awt.Graphics.hitClip(int, int, int, int) definition code for java.awt.Graphics.hitClip(int, int, int, int) (int x, int y, int width, int height)
          Returns true if the specified rectangular area might intersect the current clipping area.
abstract  void setClip sample code for java.awt.Graphics.setClip(int, int, int, int) definition code for java.awt.Graphics.setClip(int, int, int, int) (int x, int y, int width, int height)
          Sets the current clip to the rectangle specified by the given coordinates.
abstract  void setClip sample code for java.awt.Graphics.setClip(java.awt.Shape) definition code for java.awt.Graphics.setClip(java.awt.Shape) (Shape sample code for java.awt.Shape definition code for java.awt.Shape  clip)
          Sets the current clipping area to an arbitrary clip shape.
abstract  void setColor sample code for java.awt.Graphics.setColor(java.awt.Color) definition code for java.awt.Graphics.setColor(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  c)
          Sets this graphics context's current color to the specified color.
abstract  void setFont sample code for java.awt.Graphics.setFont(java.awt.Font) definition code for java.awt.Graphics.setFont(java.awt.Font) (Font sample code for java.awt.Font definition code for java.awt.Font  font)
          Sets this graphics context's font to the specified font.
abstract  void setPaintMode sample code for java.awt.Graphics.setPaintMode() definition code for java.awt.Graphics.setPaintMode() ()
          Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color.
abstract  void setXORMode sample code for java.awt.Graphics.setXORMode(java.awt.Color) definition code for java.awt.Graphics.setXORMode(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  c1)
          Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.Graphics.toString() definition code for java.awt.Graphics.toString() ()
          Returns a String object representing this Graphics object's value.
abstract  void translate sample code for java.awt.Graphics.translate(int, int) definition code for java.awt.Graphics.translate(int, int) (int x, int y)
          Translates the origin of the graphics context to the point (xy) in the current coordinate system.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Graphics sample code for java.awt.Graphics() definition code for java.awt.Graphics()

protected Graphics()
Constructs a new Graphics object. This constructor is the default contructor for a graphics context.

Since Graphics is an abstract class, applications cannot call this constructor directly. Graphics contexts are obtained from other graphics contexts or are created by calling getGraphics on a component.

See Also:
create() sample code for java.awt.Graphics.create() definition code for java.awt.Graphics.create() , Component.getGraphics() sample code for java.awt.Component.getGraphics() definition code for java.awt.Component.getGraphics()
Method Detail

create sample code for java.awt.Graphics.create() definition code for java.awt.Graphics.create()

public abstract Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  create()
Creates a new Graphics object that is a copy of this Graphics object.

Returns:
a new graphics context that is a copy of this graphics context.

create sample code for java.awt.Graphics.create(int, int, int, int) definition code for java.awt.Graphics.create(int, int, int, int)

public Graphics sample code for java.awt.Graphics definition code for java.awt.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. The new Graphics object has its origin translated to the specified point (xy). Its clip area is determined by the intersection of the original clip area with the specified rectangle. The arguments are all interpreted in the coordinate system of the original Graphics object. The new graphics context is identical to the original, except in two respects:

Parameters:
x - the x coordinate.
y - the y coordinate.
width - the width of the clipping rectangle.
height - the height of the clipping rectangle.
Returns:
a new graphics context.
See Also:
translate(int, int) sample code for java.awt.Graphics.translate(int, int) definition code for java.awt.Graphics.translate(int, int) , clipRect(int, int, int, int) sample code for java.awt.Graphics.clipRect(int, int, int, int) definition code for java.awt.Graphics.clipRect(int, int, int, int)

translate sample code for java.awt.Graphics.translate(int, int) definition code for java.awt.Graphics.translate(int, int)

public abstract void translate(int x,
                               int y)
Translates the origin of the graphics context to the point (xy) in the current coordinate system. Modifies this graphics context so that its new origin corresponds to the point (xy) in this graphics context's original coordinate system. All coordinates used in subsequent rendering operations on this graphics context will be relative to this new origin.

Parameters:
x - the x coordinate.
y - the y coordinate.

getColor sample code for java.awt.Graphics.getColor() definition code for java.awt.Graphics.getColor()

public abstract Color sample code for java.awt.Color definition code for java.awt.Color  getColor()
Gets this graphics context's current color.

Returns:
this graphics context's current color.
See Also:
Color sample code for java.awt.Color definition code for java.awt.Color , setColor(Color) sample code for java.awt.Graphics.setColor(java.awt.Color) definition code for java.awt.Graphics.setColor(java.awt.Color)

setColor sample code for java.awt.Graphics.setColor(java.awt.Color) definition code for java.awt.Graphics.setColor(java.awt.Color)

public abstract void setColor(Color sample code for java.awt.Color definition code for java.awt.Color  c)
Sets this graphics context's current color to the specified color. All subsequent graphics operations using this graphics context use this specified color.

Parameters:
c - the new rendering color.
See Also:
Color sample code for java.awt.Color definition code for java.awt.Color , getColor() sample code for java.awt.Graphics.getColor() definition code for java.awt.Graphics.getColor()

setPaintMode sample code for java.awt.Graphics.setPaintMode() definition code for java.awt.Graphics.setPaintMode()

public abstract void setPaintMode()
Sets the paint mode of this graphics context to overwrite the destination with this graphics context's current color. This sets the logical pixel operation function to the paint or overwrite mode. All subsequent rendering operations will overwrite the destination with the current color.


setXORMode sample code for java.awt.Graphics.setXORMode(java.awt.Color) definition code for java.awt.Graphics.setXORMode(java.awt.Color)

public abstract void setXORMode(Color sample code for java.awt.Color definition code for java.awt.Color  c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. This specifies that logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color.

When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.

Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.

Parameters:
c1 - the XOR alternation color

getFont sample code for java.awt.Graphics.getFont() definition code for java.awt.Graphics.getFont()

public abstract Font sample code for java.awt.Font definition code for java.awt.Font  getFont()
Gets the current font.

Returns:
this graphics context's current font.
See Also:
Font sample code for java.awt.Font definition code for java.awt.Font , setFont(Font) sample code for java.awt.Graphics.setFont(java.awt.Font) definition code for java.awt.Graphics.setFont(java.awt.Font)

setFont sample code for java.awt.Graphics.setFont(java.awt.Font) definition code for java.awt.Graphics.setFont(java.awt.Font)

public abstract void setFont(Font sample code for java.awt.Font definition code for java.awt.Font  font)
Sets this graphics context's font to the specified font. All subsequent text operations using this graphics context use this font.

Parameters:
font - the font.
See Also:
getFont() sample code for java.awt.Graphics.getFont() definition code for java.awt.Graphics.getFont() , drawString(java.lang.String, int, int) sample code for java.awt.Graphics.drawString(java.lang.String, int, int) definition code for java.awt.Graphics.drawString(java.lang.String, int, int) , drawBytes(byte[], int, int, int, int) sample code for java.awt.Graphics.drawBytes(byte[], int, int, int, int) definition code for java.awt.Graphics.drawBytes(byte[], int, int, int, int) , drawChars(char[], int, int, int, int) sample code for java.awt.Graphics.drawChars(char[], int, int, int, int) definition code for java.awt.Graphics.drawChars(char[], int, int, int, int)

getFontMetrics sample code for java.awt.Graphics.getFontMetrics() definition code for java.awt.Graphics.getFontMetrics()

public FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics  getFontMetrics()
Gets the font metrics of the current font.

Returns:
the font metrics of this graphics context's current font.
See Also:
getFont() sample code for java.awt.Graphics.getFont() definition code for java.awt.Graphics.getFont() , FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics , getFontMetrics(Font) sample code for java.awt.Graphics.getFontMetrics(java.awt.Font) definition code for java.awt.Graphics.getFontMetrics(java.awt.Font)

getFontMetrics sample code for java.awt.Graphics.getFontMetrics(java.awt.Font) definition code for java.awt.Graphics.getFontMetrics(java.awt.Font)

public abstract FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics  getFontMetrics(Font sample code for java.awt.Font definition code for java.awt.Font  f)
Gets the font metrics for the specified font.

Parameters:
f - the specified font
Returns:
the font metrics for the specified font.
See Also:
getFont() sample code for java.awt.Graphics.getFont() definition code for java.awt.Graphics.getFont() , FontMetrics sample code for java.awt.FontMetrics definition code for java.awt.FontMetrics , getFontMetrics() sample code for java.awt.Graphics.getFontMetrics()