|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Graphics
Graphics is the abstract base class for all graphic contexts for various devices.
Constructor Summary | |
protected |
Graphics()
Constructs a new Graphics Object. |
Method Summary | |
abstract void |
clearRect(int x,
int y,
int width,
int height)
Clears the specified rectangle by filling it with the current background color of the current drawing surface. |
abstract void |
clipRect(int x,
int y,
int width,
int height)
Clips to a rectangle. |
abstract void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
Copies an area of the screen. |
abstract Graphics |
create()
Creates a new Graphics Object that is a copy of the original Graphics Object. |
Graphics |
create(int x,
int y,
int width,
int height)
Creates a new Graphics Object with the specified parameters, based on the original Graphics Object. |
abstract void |
dispose()
Disposes of this graphics context. |
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Draws a highlighted 3-D rectangle. |
abstract void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws an arc bounded by the specified rectangle starting at startAngle, where 0 degrees is at the 3-o'clock position, and extending for arcAngle degrees. |
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
Draws the specified bytes using the current font and color. |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
Draws the specified characters using the current font and color. |
abstract boolean |
drawImage(Image img,
int x,
int y,
Color bgcolor,
java.awt.image.ImageObserver observer)
Draws the specified image at the specified coordinate (x, y), with the given solid background Color. |
abstract boolean |
drawImage(Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
Draws the specified image at the specified coordinate (x, y). |
abstract boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
java.awt.image.ImageObserver observer)
Draws the specified image inside the specified rectangle, with the given solid background Color. |
abstract boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
Draws the specified image inside the specified rectangle. |
abstract void |
drawLine(int x1,
int y1,
int x2,
int y2)
Draws a line between the coordinates (x1,y1) and (x2,y2). |
abstract void |
drawOval(int x,
int y,
int width,
int height)
Draws an oval inside the specified rectangle using the current color. |
abstract void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Draws a polygon defined by an array of x points and y points. |
void |
drawPolygon(Polygon p)
Draws a polygon defined by the specified point. |
void |
drawRect(int x,
int y,
int width,
int height)
Draws the outline of the specified rectangle using the current color. |
abstract void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws an outlined rounded corner rectangle using the current color. |
abstract void |
drawString(String str,
int x,
int y)
Draws the specified String using the current font and color. |
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Paints a highlighted 3-D rectangle using the current color. |
abstract void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills an arc using the current color. |
abstract void |
fillOval(int x,
int y,
int width,
int height)
Fills an oval inside the specified rectangle using the current color. |
abstract void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Fills a polygon with the current color using an even-odd fill rule (otherwise known as an alternating rule). |
void |
fillPolygon(Polygon p)
Fills the specified polygon with the current color using an even-odd fill rule (otherwise known as an alternating rule). |
abstract void |
fillRect(int x,
int y,
int width,
int height)
Fills the specified rectangle with the current color. |
abstract void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rounded rectangle filled in with the current color. |
void |
finalize()
Disposes of this graphics context once it is no longer referenced. |
abstract Rectangle |
getClipRect()
Returns the bounding rectangle of the current clipping area. |
abstract Color |
getColor()
Gets the current color. |
abstract Font |
getFont()
Gets the current font. |
FontMetrics |
getFontMetrics()
Gets the current font metrics. |
abstract FontMetrics |
getFontMetrics(Font f)
Gets the current font metrics for the specified font. |
abstract void |
setColor(Color c)
Sets the current color to the specified color. |
abstract void |
setFont(Font font)
Sets the font for all subsequent text-drawing operations. |
abstract void |
setPaintMode()
Sets the paint mode to overwrite the destination with the current color. |
abstract void |
setXORMode(Color c1)
Sets the paint mode to alternate between the current color and the new specified color. |
String |
toString()
Returns a String object representing this Graphic's value. |
abstract void |
translate(int x,
int y)
Translates the specified parameters into the origin of the graphics context. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Graphics()
Component.getGraphics()
,
create()
Method Detail |
public abstract Graphics create()
public Graphics create(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the areaheight
- the height of the areatranslate(int, int)
public abstract void translate(int x, int y)
x
- the x coordinatey
- the y coordinatepublic abstract Color getColor()
setColor(java.awt.Color)
public abstract void setColor(Color c)
c
- the color to be setColor
,
getColor()
public abstract void setPaintMode()
public abstract void setXORMode(Color c1)
c1
- the second colorpublic abstract Font getFont()
setFont(java.awt.Font)
public abstract void setFont(Font font)
font
- the specified fontFont
,
getFont()
,
drawString(java.lang.String, int, int)
,
drawBytes(byte[], int, int, int, int)
,
drawChars(char[], int, int, int, int)
public FontMetrics getFontMetrics()
getFont()
public abstract FontMetrics getFontMetrics(Font f)
f
- the specified fontgetFont()
,
getFontMetrics()
public abstract Rectangle getClipRect()
clipRect(int, int, int, int)
public abstract void clipRect(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglegetClipRect()
public abstract void copyArea(int x, int y, int width, int height, int dx, int dy)
x
- the x-coordinate of the sourcey
- the y-coordinate of the sourcewidth
- the widthheight
- the heightdx
- the horizontal distancedy
- the vertical distancepublic abstract void drawLine(int x1, int y1, int x2, int y2)
x1
- the first point's x coordinatey1
- the first point's y coordinatex2
- the second point's x coordinatey2
- the second point's y coordinatepublic abstract void fillRect(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangledrawRect(int, int, int, int)
,
clearRect(int, int, int, int)
public void drawRect(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillRect(int, int, int, int)
,
clearRect(int, int, int, int)
public abstract void clearRect(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillRect(int, int, int, int)
,
drawRect(int, int, int, int)
public abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglearcWidth
- the horizontal diameter of the arc at the four cornersarcHeight
- the horizontal diameter of the arc at the four cornersfillRoundRect(int, int, int, int, int, int)
public abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglearcWidth
- the horizontal diameter of the arc at the four cornersarcHeight
- the horizontal diameter of the arc at the four cornersdrawRoundRect(int, int, int, int, int, int)
public void draw3DRect(int x, int y, int width, int height, boolean raised)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleraised
- a boolean that states whether the rectangle is raised or notpublic void fill3DRect(int x, int y, int width, int height, boolean raised)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleraised
- a boolean that states whether the rectangle is raised or notpublic abstract void drawOval(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglefillOval(int, int, int, int)
public abstract void fillOval(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangledrawOval(int, int, int, int)
public abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectanglestartAngle
- the beginning anglearcAngle
- the angle of the arc (relative to startAngle).fillArc(int, int, int, int, int, int)
public abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
x
- the x coordinatey
- the y coordinatewidth
- the width of the archeight
- the height of the arcstartAngle
- the beginning anglearcAngle
- the angle of the arc (relative to startAngle).drawArc(int, int, int, int, int, int)
public abstract void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsfillPolygon(int[], int[], int)
public void drawPolygon(Polygon p)
p
- the specified polygonfillPolygon(int[], int[], int)
public abstract void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsdrawPolygon(int[], int[], int)
public void fillPolygon(Polygon p)
p
- the polygondrawPolygon(int[], int[], int)
public abstract void drawString(String str, int x, int y)
str
- the String to be drawnx
- the x coordinatey
- the y coordinatedrawChars(char[], int, int, int, int)
,
drawBytes(byte[], int, int, int, int)
public void drawChars(char[] data, int offset, int length, int x, int y)
data
- the array of characters to be drawnoffset
- the start offset in the datalength
- the number of characters to be drawnx
- the x coordinatey
- the y coordinatedrawString(java.lang.String, int, int)
,
drawBytes(byte[], int, int, int, int)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
data
- the data to be drawnoffset
- the start offset in the datalength
- the number of bytes that are drawnx
- the x coordinatey
- the y coordinatedrawString(java.lang.String, int, int)
,
drawChars(char[], int, int, int, int)
public abstract boolean drawImage(Image img, int x, int y, java.awt.image.ImageObserver observer)
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinateobserver
- notifies if the image is complete or notImage
,
ImageObserver
public abstract boolean drawImage(Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleobserver
- notifies if the image is complete or notImage
,
ImageObserver
public abstract boolean drawImage(Image img, int x, int y, Color bgcolor, java.awt.image.ImageObserver observer)
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinateobserver
- notifies if the image is complete or notImage
,
ImageObserver
public abstract boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, java.awt.image.ImageObserver observer)
img
- the specified image to be drawnx
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleobserver
- notifies if the image is complete or notImage
,
ImageObserver
public abstract void dispose()
finalize()
public void finalize()
finalize
in class Object
dispose()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |