public class DebugGraphics extends java.awt.Graphics
Graphics that can be used for debugging
custom Swing widgets. DebugGraphics has the ability to
draw slowly and can log drawing actions.| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFERED_OPTION
BUFFERED_OPTION
|
static int |
FLASH_OPTION
FLASH_OPTION
|
static int |
LOG_OPTION
LOG_OPTION
|
static int |
NONE_OPTION
NONE_OPTION
|
| Constructor and Description |
|---|
DebugGraphics()
Creates a
DebugGraphics object. |
DebugGraphics(java.awt.Graphics graphics)
Creates a
DebugGraphics object. |
DebugGraphics(java.awt.Graphics graphics,
JComponent component)
Creates a
DebugGraphics object. |
| Modifier and Type | Method and Description |
|---|---|
void |
clearRect(int x,
int y,
int width,
int height)
clearRect
|
void |
clipRect(int x,
int y,
int width,
int height)
Intersects the current clip region with the given region.
|
void |
copyArea(int x,
int y,
int width,
int height,
int destx,
int desty)
copyArea
|
java.awt.Graphics |
create()
Creates a overrides
Graphics.create to create a
DebugGraphics object. |
java.awt.Graphics |
create(int x,
int y,
int width,
int height)
Creates a overrides
Graphics.create to create a
DebugGraphics object. |
void |
dispose()
Releases all system resources that this
Graphics is using. |
void |
draw3DRect(int x,
int y,
int width,
int height,
boolean raised)
draw3DRect
|
void |
drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
drawArc
|
void |
drawBytes(byte[] data,
int offset,
int length,
int x,
int y)
drawBytes
|
void |
drawChars(char[] data,
int offset,
int length,
int x,
int y)
drawChars
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.Color background,
java.awt.image.ImageObserver observer)
drawImage
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
java.awt.image.ImageObserver observer)
drawImage
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.Color background,
java.awt.image.ImageObserver observer)
drawImage
|
boolean |
drawImage(java.awt.Image image,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
drawImage
|
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 background,
java.awt.image.ImageObserver observer)
drawImage
|
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)
drawImage
|
void |
drawLine(int x1,
int y1,
int x2,
int y2)
drawLine
|
void |
drawOval(int x,
int y,
int width,
int height)
drawOval
|
void |
drawPolygon(int[] xpoints,
int[] ypoints,
int npoints)
drawPolygon
|
void |
drawPolyline(int[] xpoints,
int[] ypoints,
int npoints)
drawPolyline
|
void |
drawRect(int x,
int y,
int width,
int height)
Draws a rectangle.
|
void |
drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
drawRoundRect
|
void |
drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
drawString
|
void |
drawString(java.lang.String string,
int x,
int y)
drawString
|
void |
fill3DRect(int x,
int y,
int width,
int height,
boolean raised)
fill3DRect
|
void |
fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
fillArc
|
void |
fillOval(int x,
int y,
int width,
int height)
fillOval
|
void |
fillPolygon(int[] xpoints,
int[] ypoints,
int npoints)
fillPolygon
|
void |
fillRect(int x,
int y,
int width,
int height)
Draws a filled rectangle.
|
void |
fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
fillRoundRect
|
static java.awt.Color |
flashColor()
flashColor
|
static int |
flashCount()
flashCount
|
static int |
flashTime()
flashTime
|
java.awt.Shape |
getClip()
Returns the current clipping region.
|
java.awt.Rectangle |
getClipBounds()
getClipBounds
|
java.awt.Color |
getColor()
Returns the color used for drawing.
|
int |
getDebugOptions()
getDebugOptions
|
java.awt.Font |
getFont()
getFont
|
java.awt.FontMetrics |
getFontMetrics()
Returns the font metrics of the current font.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font)
Returns the font metrics for a given font.
|
boolean |
isDrawingBuffer()
isDrawingBuffer
|
static java.io.PrintStream |
logStream()
logStream
|
void |
setClip(int x,
int y,
int width,
int height)
Sets the clipping region.
|
void |
setClip(java.awt.Shape shape)
Sets the current clipping region
|
void |
setColor(java.awt.Color color)
Sets the color to draw stuff with.
|
void |
setDebugOptions(int options)
setDebugOptions
|
static void |
setFlashColor(java.awt.Color color)
setFlashColor
|
static void |
setFlashCount(int count)
setFlashCount
|
static void |
setFlashTime(int time)
setFlashTime
|
void |
setFont(java.awt.Font font)
setFont
|
static void |
setLogStream(java.io.PrintStream stream)
setLogStream
|
void |
setPaintMode()
setPaintMode
|
void |
setXORMode(java.awt.Color color)
setXORMode
|
void |
translate(int x,
int y)
translate
|
public static final int LOG_OPTION
public static final int FLASH_OPTION
public static final int BUFFERED_OPTION
public static final int NONE_OPTION
public DebugGraphics()
DebugGraphics object.public DebugGraphics(java.awt.Graphics graphics, JComponent component)
DebugGraphics object.graphics - The Graphics object to wrapcomponent - TODOpublic DebugGraphics(java.awt.Graphics graphics)
DebugGraphics object.graphics - The Graphics object to wrappublic void setColor(java.awt.Color color)
setColor in class java.awt.Graphicscolor - The colorpublic java.awt.Graphics create()
Graphics.create to create a
DebugGraphics object.create in class java.awt.GraphicsDebugGraphics object.public java.awt.Graphics create(int x, int y, int width, int height)
Graphics.create to create a
DebugGraphics object.create in class java.awt.Graphicsx - the x coordinatey - the y coordinatewidth - the widthheight - the heightDebugGraphics object.public static java.awt.Color flashColor()
public static void setFlashColor(java.awt.Color color)
color - the color to use for flashingpublic static int flashTime()
public static void setFlashTime(int time)
time - The time in millisecondspublic static int flashCount()
public static void setFlashCount(int count)
count - The number of flashespublic static java.io.PrintStream logStream()
PrintStream to write logging messages topublic static void setLogStream(java.io.PrintStream stream)
stream - The currently set PrintStream.public java.awt.Font getFont()
getFont in class java.awt.Graphicspublic void setFont(java.awt.Font font)
setFont in class java.awt.Graphicsfont - The font to use for drawing textpublic java.awt.Color getColor()
getColor in class java.awt.Graphicspublic java.awt.FontMetrics getFontMetrics()
getFontMetrics in class java.awt.GraphicsFontMetrics objectpublic java.awt.FontMetrics getFontMetrics(java.awt.Font font)
getFontMetrics in class java.awt.Graphicsfont - the font to get the metrics forFontMetrics objectpublic void translate(int x, int y)
translate in class java.awt.Graphicsx - the x coordinatey - the y coordinatepublic void setPaintMode()
setPaintMode in class java.awt.Graphicspublic void setXORMode(java.awt.Color color)
setXORMode in class java.awt.Graphicscolor - the colorpublic java.awt.Rectangle getClipBounds()
getClipBounds in class java.awt.Graphicspublic void clipRect(int x, int y, int width, int height)
clipRect in class java.awt.Graphicsx - The x-position of the regiony - The y-position of the regionwidth - The width of the regionheight - The height of the regionpublic void setClip(int x, int y, int width, int height)
setClip in class java.awt.Graphicsx - The x-position of the regiony - The y-position of the regionwidth - The width of the regionheight - The height of the regionpublic java.awt.Shape getClip()
getClip in class java.awt.Graphicspublic void setClip(java.awt.Shape shape)
setClip in class java.awt.Graphicsshape - The clippin regionpublic void drawRect(int x, int y, int width, int height)
drawRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectanglepublic void fillRect(int x, int y, int width, int height)
fillRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectanglepublic void clearRect(int x, int y, int width, int height)
clearRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectanglepublic void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectanglearcWidth - TODOarcHeight - TODOpublic void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectanglearcWidth - TODOarcHeight - TODOpublic void drawLine(int x1, int y1, int x2, int y2)
drawLine in class java.awt.Graphicsx1 - The x-position of the starty1 - The y-position of the startx2 - The x-position of the endy2 - The y-position of the endpublic void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectangleraised - TODOpublic void fill3DRect(int x, int y, int width, int height, boolean raised)
fill3DRect in class java.awt.Graphicsx - The x-position of the rectangley - The y-position of the rectanglewidth - The width of the rectangleheight - The height of the rectangleraised - TODOpublic void drawOval(int x, int y, int width, int height)
drawOval in class java.awt.Graphicsx - the x coordinatey - the y coordiantewidth - the widthheight - the heightpublic void fillOval(int x, int y, int width, int height)
fillOval in class java.awt.Graphicsx - the x coordinatey - the y coordinatewidth - the widthheight - the heightpublic void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
drawArc in class java.awt.Graphicsx - the x coordinatey - the y coordinatewidth - the widthheight - the heightstartAngle - TODOarcAngle - TODOpublic void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
fillArc in class java.awt.Graphicsx - the coordinatey - the y coordinatewidth - the widthheight - the heightstartAngle - TODOarcAngle - TODOpublic void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
drawPolyline in class java.awt.Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
drawPolygon in class java.awt.Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
fillPolygon in class java.awt.Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void drawString(java.lang.String string, int x, int y)
drawString in class java.awt.Graphicsstring - the stringx - the x coordinatey - the y coordinatepublic void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
drawString in class java.awt.Graphicsiterator - TODOx - the x coordinatey - the y coordinatepublic void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes in class java.awt.Graphicsdata - TODOoffset - TODOlength - TODOx - the x coordinatey - the y coordinatepublic void drawChars(char[] data, int offset, int length, int x, int y)
drawChars in class java.awt.Graphicsdata - array of characters to drawoffset - offset in arraylength - number of characters in array to drawx - x-positiony - y-positionpublic boolean drawImage(java.awt.Image image, int x, int y, java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimage - The image to drawx - The x positiony - The y positionobserver - The image observerpublic boolean drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimage - The image to drawx - The x positiony - The y positionwidth - The width of the area to draw the imageheight - The height of the area to draw the imageobserver - The image observerpublic boolean drawImage(java.awt.Image image, int x, int y, java.awt.Color background, java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimage - The image to drawx - The x positiony - The y positionbackground - The color for the background in the opaque regions
of the imageobserver - The image observerpublic boolean drawImage(java.awt.Image image, int x, int y, int width, int height, java.awt.Color background, java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimage - The image to drawx - The x positiony - The y positionwidth - The width of the area to draw the imageheight - The height of the area to draw the imagebackground - The color for the background in the opaque regions
of the imageobserver - The image observerpublic 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)
drawImage in class java.awt.Graphicsimage - The image to drawdx1 - TODOdy1 - TODOdx2 - TODOdy2 - TODOsx1 - TODOsy1 - TODOsx2 - TODOsy2 - TODOobserver - The image observerpublic 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 background, java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimage - The image to drawdx1 - TODOdy1 - TODOdx2 - TODOdy2 - TODOsx1 - TODOsy1 - TODOsx2 - TODOsy2 - TODObackground - The color for the background in the opaque regions
of the imageobserver - The image observerpublic void copyArea(int x, int y, int width, int height, int destx, int desty)
copyArea in class java.awt.Graphicsx - The x position of the source areay - The y position of the source areawidth - The width of the areaheight - The height of the areadestx - The x position of the destination areadesty - The y posiiton of the destination areapublic void dispose()
Graphics is using.dispose in class java.awt.Graphicspublic boolean isDrawingBuffer()
public void setDebugOptions(int options)
options - the debug optionspublic int getDebugOptions()