|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Graphics | +--javax.swing.DebugGraphics
Graphics subclass supporting graphics debugging. Overrides most methods from Graphics. DebugGraphics objects are rarely created by hand. They are most frequently created automatically when a JComponent's debugGraphicsOptions are changed using the setDebugGraphicsOptions() method.
NOTE: You must turn off double buffering to use DebugGraphics: RepaintManager repaintManager = RepaintManager.currentManager(component); repaintManager.setDoubleBufferingEnabled(false);
JComponent.setDebugGraphicsOptions(int)
,
RepaintManager.currentManager(java.awt.Component)
,
RepaintManager.setDoubleBufferingEnabled(boolean)
Field Summary | |
static int |
BUFFERED_OPTION
Show buffered operations in a seperate Frame. |
static int |
FLASH_OPTION
Flash graphics operations. |
static int |
LOG_OPTION
Log graphics operations. |
static int |
NONE_OPTION
Don't debug graphics operations. |
Constructor Summary | |
DebugGraphics()
Constructs a new debug graphics context that supports slowed down drawing. |
|
DebugGraphics(Graphics graphics)
Constructs a debug graphics context from an existing graphics context that supports slowed down drawing. |
|
DebugGraphics(Graphics graphics,
JComponent component)
Constructs a debug graphics context from an existing graphics context that slows down drawing for the specified component. |
Method Summary | |
void |
clearRect(int x,
int y,
int width,
int height)
Overrides Graphics.clearRect . |
void |
clipRect(int x,
int y,
int width,
int height)
Overrides Graphics.clipRect . |
void |
copyArea(int x,
int y,
int width,
int height,
int destX,
int destY)
Overrides Graphics.copyArea . |
Graphics |
create()
Overrides Graphics.create to return a DebugGraphics object. |
Graphics |
create(int x,
int y,
int width,
int height)
Overrides Graphics.create to return a DebugGraphics object. |
void |
dispose()
Overrides Graphics.dispose . |
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
Overrides Graphics.draw3DRect . |
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Overrides Graphics.drawArc . |
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
Overrides Graphics.drawBytes . |
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
Overrides Graphics.drawChars . |
boolean |
drawImage(Image img,
int x,
int y,
Color bgcolor,
ImageObserver observer)
Overrides Graphics.drawImage . |
boolean |
drawImage(Image img,
int x,
int y,
ImageObserver observer)
Overrides Graphics.drawImage . |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
Color bgcolor,
ImageObserver observer)
Overrides Graphics.drawImage . |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer)
Overrides Graphics.drawImage . |
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color bgcolor,
ImageObserver observer)
Overrides Graphics.drawImage . |
boolean |
drawImage(Image img,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
ImageObserver observer)
Overrides Graphics.drawImage . |
void |
drawLine(int x1,
int y1,
int x2,
int y2)
Overrides Graphics.drawLine . |
void |
drawOval(int x,
int y,
int width,
int height)
Overrides Graphics.drawOval . |
void |
drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Overrides Graphics.drawPolygon . |
void |
drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
Overrides Graphics.drawPolyline . |
void |
drawRect(int x,
int y,
int width,
int height)
Overrides Graphics.drawRect . |
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Overrides Graphics.drawRoundRect . |
void |
drawString(AttributedCharacterIterator iterator,
int x,
int y)
Overrides Graphics.drawString . |
void |
drawString(String aString,
int x,
int y)
Overrides Graphics.drawString . |
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
Overrides Graphics.fill3DRect . |
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Overrides Graphics.fillArc . |
void |
fillOval(int x,
int y,
int width,
int height)
Overrides Graphics.fillOval . |
void |
fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
Overrides Graphics.fillPolygon . |
void |
fillRect(int x,
int y,
int width,
int height)
Overrides Graphics.fillRect . |
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Overrides Graphics.fillRoundRect . |
static Color |
flashColor()
Returns the Color used to flash drawing operations. |
static int |
flashCount()
Returns the number of times that drawing operations will flash. |
static int |
flashTime()
Returns the time delay of drawing operation flashing. |
Shape |
getClip()
Overrides Graphics.getClip . |
Rectangle |
getClipBounds()
Overrides Graphics.getClipBounds . |
Color |
getColor()
Returns the Color used for text drawing operations. |
int |
getDebugOptions()
Returns the current debugging options for this DebugGraphics. |
Font |
getFont()
Returns the Font used for text drawing operations. |
FontMetrics |
getFontMetrics()
Overrides Graphics.getFontMetrics . |
FontMetrics |
getFontMetrics(Font f)
Overrides Graphics.getFontMetrics . |
boolean |
isDrawingBuffer()
Returns the drawingBuffer value. |
static PrintStream |
logStream()
Returns the stream to which the DebugGraphics logs drawing operations. |
void |
setClip(int x,
int y,
int width,
int height)
Overrides Graphics.setClip . |
void |
setClip(Shape clip)
Overrides Graphics.setClip . |
void |
setColor(Color aColor)
Sets the color to be used for drawing and filling lines and shapes. |
void |
setDebugOptions(int options)
Enables/disables diagnostic information about every graphics operation. |
static void |
setFlashColor(Color flashColor)
Sets the Color used to flash drawing operations. |
static void |
setFlashCount(int flashCount)
Sets the number of times that drawing operations will flash. |
static void |
setFlashTime(int flashTime)
Sets the time delay of drawing operation flashing. |
void |
setFont(Font aFont)
Sets the Font used for text drawing operations. |
static void |
setLogStream(PrintStream stream)
Sets the stream to which the DebugGraphics logs drawing operations. |
void |
setPaintMode()
Overrides Graphics.setPaintMode . |
void |
setXORMode(Color aColor)
Overrides Graphics.setXORMode . |
void |
translate(int x,
int y)
Overrides Graphics.translate . |
Methods inherited from class java.awt.Graphics |
drawPolygon,
fillPolygon,
finalize,
getClipBounds,
getClipRect,
hitClip,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int LOG_OPTION
public static final int FLASH_OPTION
public static final int BUFFERED_OPTION
public static final int NONE_OPTION
Constructor Detail |
public DebugGraphics()
public DebugGraphics(Graphics graphics, JComponent component)
graphics
- the Graphics context to slow downcomponent
- the JComponent to draw slowlypublic DebugGraphics(Graphics graphics)
graphics
- the Graphics context to slow downMethod Detail |
public Graphics create()
Graphics.create
to return a DebugGraphics object.public Graphics create(int x, int y, int width, int height)
Graphics.create
to return a DebugGraphics object.x
- the x coordinate.y
- the y coordinate.width
- the width of the clipping rectangle.height
- the height of the clipping rectangle.Graphics.translate(int, int)
,
Graphics.clipRect(int, int, int, int)
public static void setFlashColor(Color flashColor)
public static Color flashColor()
setFlashColor(java.awt.Color)
public static void setFlashTime(int flashTime)
public static int flashTime()
setFlashTime(int)
public static void setFlashCount(int flashCount)
public static int flashCount()
setFlashCount(int)
public static void setLogStream(PrintStream stream)
public static PrintStream logStream()
setLogStream(java.io.PrintStream)
public void setFont(Font aFont)
font
- the font.Graphics.getFont()
,
java.awt.Graphics#drawChars(java.lang.String, int, int)
,
java.awt.Graphics#drawString(byte[], int, int, int, int)
,
java.awt.Graphics#drawBytes(char[], int, int, int, int)
public Font getFont()
setFont(java.awt.Font)
public void setColor(Color aColor)
c
- the new rendering color.Color
,
Graphics.getColor()
public Color getColor()
setColor(java.awt.Color)
public FontMetrics getFontMetrics()
Graphics.getFontMetrics
.Graphics.getFont()
,
FontMetrics
,
Graphics.getFontMetrics(Font)
public FontMetrics getFontMetrics(Font f)
Graphics.getFontMetrics
.f
- the specified fontGraphics.getFont()
,
FontMetrics
,
Graphics.getFontMetrics()
public void translate(int x, int y)
Graphics.translate
.x
- the x coordinate.y
- the y coordinate.public void setPaintMode()
Graphics.setPaintMode
.public void setXORMode(Color aColor)
Graphics.setXORMode
.c1
- the XOR alternation colorpublic Rectangle getClipBounds()
Graphics.getClipBounds
.null
if no clip is set.Graphics.getClip()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void clipRect(int x, int y, int width, int height)
Graphics.clipRect
.x
- the x coordinate of the rectangle to intersect the clip withy
- the y coordinate of the rectangle to intersect the clip withwidth
- the width of the rectangle to intersect the clip withheight
- the height of the rectangle to intersect the clip withGraphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void setClip(int x, int y, int width, int height)
Graphics.setClip
.x
- the x coordinate of the new clip rectangle.y
- the y coordinate of the new clip rectangle.width
- the width of the new clip rectangle.height
- the height of the new clip rectangle.Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(Shape)
public Shape getClip()
Graphics.getClip
.Shape
object representing the
current clipping area, or null
if
no clip is set.Graphics.getClipBounds()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
,
Graphics.setClip(Shape)
public void setClip(Shape clip)
Graphics.setClip
.clip
- the Shape
to use to set the clipGraphics.getClip()
,
Graphics.clipRect(int, int, int, int)
,
Graphics.setClip(int, int, int, int)
public void drawRect(int x, int y, int width, int height)
Graphics.drawRect
.x
- the x coordinate
of the rectangle to be drawn.y
- the y coordinate
of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.Graphics.fillRect(int, int, int, int)
,
Graphics.clearRect(int, int, int, int)
public void fillRect(int x, int y, int width, int height)
Graphics.fillRect
.x
- the x coordinate
of the rectangle to be filled.y
- the y coordinate
of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.Graphics.clearRect(int, int, int, int)
,
Graphics.drawRect(int, int, int, int)
public void clearRect(int x, int y, int width, int height)
Graphics.clearRect
.x
- the x coordinate of the rectangle to clear.y
- the y coordinate of the rectangle to clear.width
- the width of the rectangle to clear.height
- the height of the rectangle to clear.Graphics.fillRect(int, int, int, int)
,
Graphics.drawRect(int, int, int, int)
,
Graphics.setColor(java.awt.Color)
,
Graphics.setPaintMode()
,
Graphics.setXORMode(java.awt.Color)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics.drawRoundRect
.x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.arcWidth
- the horizontal diameter of the arc
at the four corners.arcHeight
- the vertical diameter of the arc
at the four corners.Graphics.fillRoundRect(int, int, int, int, int, int)
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Graphics.fillRoundRect
.x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.arcWidth
- the horizontal diameter
of the arc at the four corners.arcHeight
- the vertical diameter
of the arc at the four corners.Graphics.drawRoundRect(int, int, int, int, int, int)
public void drawLine(int x1, int y1, int x2, int y2)
Graphics.drawLine
.x1
- the first point's x coordinate.y1
- the first point's y coordinate.x2
- the second point's x coordinate.y2
- the second point's y coordinate.public void draw3DRect(int x, int y, int width, int height, boolean raised)
Graphics.draw3DRect
.x
- the x coordinate of the rectangle to be drawn.y
- the y coordinate of the rectangle to be drawn.width
- the width of the rectangle to be drawn.height
- the height of the rectangle to be drawn.raised
- a boolean that determines whether the rectangle
appears to be raised above the surface
or sunk into the surface.Graphics.fill3DRect(int, int, int, int, boolean)
public void fill3DRect(int x, int y, int width, int height, boolean raised)
Graphics.fill3DRect
.x
- the x coordinate of the rectangle to be filled.y
- the y coordinate of the rectangle to be filled.width
- the width of the rectangle to be filled.height
- the height of the rectangle to be filled.raised
- a boolean value that determines whether the
rectangle appears to be raised above the surface
or etched into the surface.Graphics.draw3DRect(int, int, int, int, boolean)
public void drawOval(int x, int y, int width, int height)
Graphics.drawOval
.x
- the x coordinate of the upper left
corner of the oval to be drawn.y
- the y coordinate of the upper left
corner of the oval to be drawn.width
- the width of the oval to be drawn.height
- the height of the oval to be drawn.Graphics.fillOval(int, int, int, int)
public void fillOval(int x, int y, int width, int height)
Graphics.fillOval
.x
- the x coordinate of the upper left corner
of the oval to be filled.y
- the y coordinate of the upper left corner
of the oval to be filled.width
- the width of the oval to be filled.height
- the height of the oval to be filled.Graphics.drawOval(int, int, int, int)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics.drawArc
.x
- the x coordinate of the
upper-left corner of the arc to be drawn.y
- the y coordinate of the
upper-left corner of the arc to be drawn.width
- the width of the arc to be drawn.height
- the height of the arc to be drawn.startAngle
- the beginning angle.arcAngle
- the angular extent of the arc,
relative to the start angle.Graphics.fillArc(int, int, int, int, int, int)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Graphics.fillArc
.x
- the x coordinate of the
upper-left corner of the arc to be filled.y
- the y coordinate of the
upper-left corner of the arc to be filled.width
- the width of the arc to be filled.height
- the height of the arc to be filled.startAngle
- the beginning angle.arcAngle
- the angular extent of the arc,
relative to the start angle.Graphics.drawArc(int, int, int, int, int, int)
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Graphics.drawPolyline
.xPoints
- an array of x pointsyPoints
- an array of y pointsnPoints
- the total number of pointsGraphics.drawPolygon(int[], int[], int)
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Graphics.drawPolygon
.xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.Graphics.fillPolygon(int[], int[], int)
,
Graphics.drawPolyline(int[], int[], int)
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Graphics.fillPolygon
.xPoints
- a an array of x
coordinates.yPoints
- a an array of y
coordinates.nPoints
- a the total number of points.Graphics.drawPolygon(int[], int[], int)
public void drawString(String aString, int x, int y)
Graphics.drawString
.str
- the string to be drawn.x
- the x coordinate.y
- the y coordinate.Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public void drawString(AttributedCharacterIterator iterator, int x, int y)
Graphics.drawString
.iterator
- the iterator whose text is to be drawnx
- the x coordinate.y
- the y coordinate.Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public void drawBytes(byte[] data, int offset, int length, int x, int y)
Graphics.drawBytes
.data
- the data to be drawnoffset
- the start offset in the datalength
- the number of bytes that are drawnx
- the x coordinate of the baseline of the texty
- the y coordinate of the baseline of the textGraphics.drawChars(char[], int, int, int, int)
,
Graphics.drawString(java.lang.String, int, int)
public void drawChars(char[] data, int offset, int length, int x, int y)
Graphics.drawChars
.data
- the array of characters to be drawnoffset
- the start offset in the datalength
- the number of characters to be drawnx
- the x coordinate of the baseline of the texty
- the y coordinate of the baseline of the textGraphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawString(java.lang.String, int, int)
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawn.x
- the x coordinate.y
- the y coordinate.observer
- object to be notified as more of
the image is converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawn.x
- the x coordinate.y
- the y coordinate.width
- the width of the rectangle.height
- the height of the rectangle.observer
- object to be notified as more of
the image is converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawn.x
- the x coordinate.y
- the y coordinate.bgcolor
- the background color to paint under the
non-opaque portions of the image.observer
- object to be notified as more of
the image is converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawn.x
- the x coordinate.y
- the y coordinate.width
- the width of the rectangle.height
- the height of the rectangle.bgcolor
- the background color to paint under the
non-opaque portions of the image.observer
- object to be notified as more of
the image is converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawndx1
- the x coordinate of the first corner of the
destination rectangle.dy1
- the y coordinate of the first corner of the
destination rectangle.dx2
- the x coordinate of the second corner of the
destination rectangle.dy2
- the y coordinate of the second corner of the
destination rectangle.sx1
- the x coordinate of the first corner of the
source rectangle.sy1
- the y coordinate of the first corner of the
source rectangle.sx2
- the x coordinate of the second corner of the
source rectangle.sy2
- the y coordinate of the second corner of the
source rectangle.observer
- object to be notified as more of the image is
scaled and converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
Graphics.drawImage
.img
- the specified image to be drawndx1
- the x coordinate of the first corner of the
destination rectangle.dy1
- the y coordinate of the first corner of the
destination rectangle.dx2
- the x coordinate of the second corner of the
destination rectangle.dy2
- the y coordinate of the second corner of the
destination rectangle.sx1
- the x coordinate of the first corner of the
source rectangle.sy1
- the y coordinate of the first corner of the
source rectangle.sx2
- the x coordinate of the second corner of the
source rectangle.sy2
- the y coordinate of the second corner of the
source rectangle.bgcolor
- the background color to paint under the
non-opaque portions of the image.observer
- object to be notified as more of the image is
scaled and converted.Image
,
ImageObserver
,
ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
public void copyArea(int x, int y, int width, int height, int destX, int destY)
Graphics.copyArea
.x
- the x coordinate of the source rectangle.y
- the y coordinate of the source rectangle.width
- the width of the source rectangle.height
- the height of the source rectangle.dx
- the horizontal distance to copy the pixels.dy
- the vertical distance to copy the pixels.public void dispose()
Graphics.dispose
.Graphics.finalize()
,
Component.paint(java.awt.Graphics)
,
Component.update(java.awt.Graphics)
,
Component.getGraphics()
,
Graphics.create()
public boolean isDrawingBuffer()
public void setDebugOptions(int options)
public int getDebugOptions()
setDebugOptions(int)
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |