java.awt
Class Graphics
java.lang.Object
|
+--java.awt.Graphics
public abstract class
Graphicsextends
Object This is the abstract superclass of classes for drawing to graphics
devices such as the screen or printers.
Authors:- Aaron M. Renn (arenn@urbanophile.com)
- Warren Levy <warrenl@cygnus.com>
void | clearRect(int x, int y, int width, int height)
|
void | clipRect(int x, int y, int width, int height)
|
void | copyArea(int x, int y, int width, int height, int dx, int dy)
|
java.awt.Graphics | create()
|
java.awt.Graphics | create(int x, int y, int width, int height)
|
void | dispose()
|
void | draw3DRect(int x, int y, int width, int height, boolean raised)
|
void | drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
|
void | drawBytes(byte[] data, int offset, int length, int x, int y)
|
void | drawChars(char[] data, int offset, int length, int x, int y)
|
void | drawChars(byte[] data, int offset, int length, int x, int y)
|
boolean | drawImage(java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer)
|
boolean | drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
|
boolean | drawImage(java.awt.Image image, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
|
boolean | drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
|
boolean | drawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
|
boolean | drawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
|
void | drawLine(int x1, int y1, int x2, int y2)
|
void | drawOval(int x, int y, int width, int height)
|
void | drawPolygon(int[] xPoints, int[] yPoints, int npoints)
|
void | drawPolygon(java.awt.Polygon polygon)
|
void | drawPolyline(int[] xPoints, int[] yPoints, int npoints)
|
void | drawRect(int x, int y, int width, int height)
|
void | drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
|
void | drawRoundRect(int x, int y, int width, int height, boolean raised)
|
void | drawString(java.lang.String string, int x, int y)
|
void | drawString(java.text.AttributedCharacterIterator ci, int x, int y)
|
void | fill3DRect(int x, int y, int width, int height, boolean raised)
|
void | fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
|
void | fillOval(int x, int y, int width, int height)
|
void | fillPolygon(int[] xPoints, int[] yPoints, int npoints)
|
void | fillPolygon(java.awt.Polygon polygon)
|
void | fillRect(int x, int y, int width, int height)
|
void | fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
|
void | finalize()
|
java.awt.Shape | getClip()
|
java.awt.Rectangle | getClipBounds()
|
java.awt.Rectangle | getClipBounds(java.awt.Rectangle r)
|
java.awt.Rectangle | getClipRect()
|
java.awt.Color | getColor()
|
java.awt.Font | getFont()
|
java.awt.FontMetrics | getFontMetrics()
|
java.awt.FontMetrics | getFontMetrics(java.awt.Font font)
|
boolean | hitClip(int x, int y, int width, int height)
|
void | setClip(int x, int y, int width, int height)
|
void | setClip(java.awt.Shape clip)
|
void | setColor(java.awt.Color color)
|
void | setFont(java.awt.Font font)
|
void | setPaintMode()
|
void | setXORMode(java.awt.Color color)
|
java.lang.String | toString()
|
void | translate(int x, int y)
|
Graphics
protected Graphics()
Default constructor for subclasses.
clearRect
public void clearRect(int x, int y, int width, int height)
Clears the specified rectangle.
Parameters:
clipRect
public void clipRect(int x, int y, int width, int height)
Sets the clipping region to the intersection of the current clipping
region and the rectangle determined by the specified parameters.
Parameters:
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)
Copies the specified rectangle to the specified offset location.
Parameters:
create
public Graphics create()
Returns a copy of this Graphics
object.
Returns:
create
public Graphics create(int x, int y, int width, int height)
Returns a copy of this Graphics
object. The origin point
will be translated to the point (x, y) and the cliping rectangle set
to the intersection of the clipping rectangle in this object and the
rectangle specified by the parameters to this method.
Parameters:
Returns:
- A copy of this object, modified as specified.
dispose
public void dispose()
Free any resources held by this graphics context immediately instead
of waiting for the object to be garbage collected and finalized.
draw3DRect
public void draw3DRect(int x, int y, int width, int height, boolean raised)
Parameters:
drawArc
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Draws an arc using the specified bounding rectangle and the specified
angle parameter. The arc is centered at the center of the rectangle.
The arc starts at the arcAngle position and extend for arcAngle
degrees. The degree origin is at the 3 o'clock position.
Parameters:
drawBytes
public void drawBytes(byte[] data, int offset, int length, int x, int y)
Parameters:
drawChars
public void drawChars(byte[] data, int offset, int length, int x, int y)
Draws the specified bytes as text starting at the specified point.
Parameters:
drawChars
public void drawChars(char[] data, int offset, int length, int x, int y)
Draws the specified characters starting at the specified point.
Parameters:
drawImage
public boolean drawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
FIXME: Write Javadocs for this when you understand it.
Parameters:
drawImage
public boolean drawImage(java.awt.Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
FIXME: Write Javadocs for this when you understand it.
Parameters:
drawImage
public boolean drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Draws all of the image that is available and returns. The image
is scaled to fit in the specified rectangle. If the image
is not completely loaded, false
is returned and
the specified iamge observer is notified as more data becomes
available.
Parameters:
Returns:
true
if all the image data is available,
false
otherwise.
drawImage
public boolean drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
Draws all of the image that is available and returns. The image
is scaled to fit in the specified rectangle. If the image
is not completely loaded, false
is returned and
the specified iamge observer is notified as more data becomes
available.
Parameters:
Returns:
true
if all the image data is available,
false
otherwise.
drawImage
public boolean drawImage(java.awt.Image image, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
Draws all of the image that is available and returns. If the image
is not completely loaded, false
is returned and
the specified iamge observer is notified as more data becomes
available.
Parameters:
Returns:
true
if all the image data is available,
false
otherwise.
drawImage
public boolean drawImage(java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer)
Draws all of the image that is available and returns. If the image
is not completely loaded, false
is returned and
the specified iamge observer is notified as more data becomes
available.
Parameters:
Returns:
true
if all the image data is available,
false
otherwise.
drawLine
public void drawLine(int x1, int y1, int x2, int y2)
Draws a line between the two specified points.
Parameters:
drawOval
public void drawOval(int x, int y, int width, int height)
Draws an oval that just fits within the specified rectangle.
Parameters:
drawPolygon
public void drawPolygon(int[] xPoints, int[] yPoints, int npoints)
Draws a series of interconnected lines determined by the arrays
of corresponding x and y coordinates. The figure is closed if necessary
by connecting the first and last points.
Parameters:
drawPolygon
public void drawPolygon(java.awt.Polygon polygon)
Draws the specified polygon.
Parameters:
drawPolyline
public void drawPolyline(int[] xPoints, int[] yPoints, int npoints)
Draws a series of interconnected lines determined by the arrays
of corresponding x and y coordinates.
Parameters:
drawRect
public void drawRect(int x, int y, int width, int height)
Draws the outline of the specified rectangle.
Parameters:
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, boolean raised)
Draws the outline of the specified rectangle with a 3D effect
Parameters:
drawRoundRect
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Draws the outline of the specified rectangle with rounded cornders.
Parameters:
drawString
public void drawString(java.lang.String string, int x, int y)
Draws the specified string starting at the specified point.
Parameters:
drawString
public void drawString(java.text.AttributedCharacterIterator ci, int x, int y)
Parameters:
fill3DRect
public void fill3DRect(int x, int y, int width, int height, boolean raised)
Fills the specified rectangle with a 3D effect
Parameters:
fillArc
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Fills the arc define by the specified bounding rectangle and the specified
angle parameter. The arc is centered at the center of the rectangle.
The arc starts at the arcAngle position and extend for arcAngle
degrees. The degree origin is at the 3 o'clock position.
Parameters:
fillOval
public void fillOval(int x, int y, int width, int height)
Fills an oval that just fits within the specified rectangle.
Parameters:
fillPolygon
public void fillPolygon(int[] xPoints, int[] yPoints, int npoints)
Fills the polygon determined by the arrays
of corresponding x and y coordinates.
Parameters:
fillPolygon
public void fillPolygon(java.awt.Polygon polygon)
Fills the specified polygon
Parameters:
fillRect
public void fillRect(int x, int y, int width, int height)
Fills the area bounded by the specified rectangle.
Parameters:
fillRoundRect
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Fills the specified rectangle with rounded cornders.
Parameters:
finalize
public void finalize()
Frees the resources held by this graphics context when it is
garbage collected.
getClip
public Shape getClip()
Returns the current clipping region as a Shape
object.
Returns:
- The clipping region as a
Shape
.
getClipBounds
public Rectangle getClipBounds()
Returns the bounding rectangle of the clipping region for this
graphics context.
Returns:
- The bounding rectangle for the clipping region.
getClipBounds
public Rectangle getClipBounds(java.awt.Rectangle r)
Parameters:
getClipRect
public Rectangle getClipRect()
Returns the bounding rectangle of the clipping region for this
graphics context.
Returns:
- The bounding rectangle for the clipping region.
getColor
public Color getColor()
Returns the current color for this object.
Returns:
- The color for this object.
getFont
public Font getFont()
Returns the current font for this graphics context.
Returns:
getFontMetrics
public FontMetrics getFontMetrics()
Returns the font metrics for the current font.
Returns:
- The font metrics for the current font.
getFontMetrics
public FontMetrics getFontMetrics(java.awt.Font font)
Returns the font metrics for the specified font.
Parameters:
Returns:
- The requested font metrics.
hitClip
public boolean hitClip(int x, int y, int width, int height)
Parameters:
setClip
public void setClip(int x, int y, int width, int height)
Sets the clipping region to the rectangle determined by the specified
parameters.
Parameters:
setClip
public void setClip(java.awt.Shape clip)
Sets the clipping region to the specified Shape
.
Parameters:
setColor
public void setColor(java.awt.Color color)
Sets the current color for this object.
Parameters:
setFont
public void setFont(java.awt.Font font)
Sets the font for this graphics context to the specified value.
Parameters:
setPaintMode
public void setPaintMode()
Sets this context into "paint" mode, where the target pixels are
completely overwritten when drawn on.
setXORMode
public void setXORMode(java.awt.Color color)
Sets this context info "XOR" mode, where the targe pixles are
XOR-ed when drawn on.
Parameters:
toString
public String toString()
Returns a string representation of this object.
translate
public void translate(int x, int y)
Translates this context so that its new origin point is the point
(x, y).
Parameters: