public class DebugGraphics extends 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(Graphics graphics)
Creates a
DebugGraphics object. |
DebugGraphics(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
|
Graphics |
create()
Creates a overrides
Graphics.create to create a
DebugGraphics object. |
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(Image image,
int x,
int y,
Color background,
ImageObserver observer)
drawImage
|
boolean |
drawImage(Image image,
int x,
int y,
ImageObserver observer)
drawImage
|
boolean |
drawImage(Image image,
int x,
int y,
int width,
int height,
Color background,
ImageObserver observer)
drawImage
|
boolean |
drawImage(Image image,
int x,
int y,
int width,
int height,
ImageObserver observer)
drawImage
|
boolean |
drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
Color background,
ImageObserver observer)
drawImage
|
boolean |
drawImage(Image image,
int dx1,
int dy1,
int dx2,
int dy2,
int sx1,
int sy1,
int sx2,
int sy2,
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(AttributedCharacterIterator iterator,
int x,
int y)
drawString
|
void |
drawString(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 Color |
flashColor()
flashColor
|
static int |
flashCount()
flashCount
|
static int |
flashTime()
flashTime
|
Shape |
getClip()
Returns the current clipping region.
|
Rectangle |
getClipBounds()
getClipBounds
|
Color |
getColor()
Returns the color used for drawing.
|
int |
getDebugOptions()
getDebugOptions
|
Font |
getFont()
getFont
|
FontMetrics |
getFontMetrics()
Returns the font metrics of the current font.
|
FontMetrics |
getFontMetrics(Font font)
Returns the font metrics for a given font.
|
boolean |
isDrawingBuffer()
isDrawingBuffer
|
static PrintStream |
logStream()
logStream
|
void |
setClip(int x,
int y,
int width,
int height)
Sets the clipping region.
|
void |
setClip(Shape shape)
Sets the current clipping region
|
void |
setColor(Color color)
Sets the color to draw stuff with.
|
void |
setDebugOptions(int options)
setDebugOptions
|
static void |
setFlashColor(Color color)
setFlashColor
|
static void |
setFlashCount(int count)
setFlashCount
|
static void |
setFlashTime(int time)
setFlashTime
|
void |
setFont(Font font)
setFont
|
static void |
setLogStream(PrintStream stream)
setLogStream
|
void |
setPaintMode()
setPaintMode
|
void |
setXORMode(Color color)
setXORMode
|
void |
translate(int x,
int y)
translate
|
drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, hitClip, toStringpublic 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(Graphics graphics, JComponent component)
DebugGraphics object.graphics - The Graphics object to wrapcomponent - TODOpublic DebugGraphics(Graphics graphics)
DebugGraphics object.graphics - The Graphics object to wrappublic Graphics create()
Graphics.create to create a
DebugGraphics object.public Graphics create(int x, int y, int width, int height)
Graphics.create to create a
DebugGraphics object.public static Color flashColor()
public static void setFlashColor(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 PrintStream logStream()
PrintStream to write logging messages topublic static void setLogStream(PrintStream stream)
stream - The currently set PrintStream.public FontMetrics getFontMetrics()
getFontMetrics in class GraphicsFontMetrics objectpublic FontMetrics getFontMetrics(Font font)
getFontMetrics in class Graphicsfont - the font to get the metrics forFontMetrics objectpublic void translate(int x, int y)
public void setPaintMode()
setPaintMode in class Graphicspublic void setXORMode(Color color)
setXORMode in class Graphicscolor - the colorpublic Rectangle getClipBounds()
getClipBounds in class Graphicspublic void clipRect(int x, int y, int width, int height)
public void setClip(int x, int y, int width, int height)
public void drawRect(int x, int y, int width, int height)
public void fillRect(int x, int y, int width, int height)
public void clearRect(int x, int y, int width, int height)
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect in class 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 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)
public void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect in class 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 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)
public void fillOval(int x, int y, int width, int height)
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
drawPolyline in class Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
drawPolygon in class Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
fillPolygon in class Graphicsxpoints - TODOypoints - TODOnpoints - TODOpublic void drawString(String string, int x, int y)
drawString in class Graphicsstring - the stringx - the x coordinatey - the y coordinatepublic void drawString(AttributedCharacterIterator iterator, int x, int y)
drawString in class Graphicsiterator - TODOx - the x coordinatey - the y coordinatepublic void drawBytes(byte[] data, int offset, int length, int x, int y)
public void drawChars(char[] data, int offset, int length, int x, int y)
public boolean drawImage(Image image, int x, int y, ImageObserver observer)
public boolean drawImage(Image image, int x, int y, int width, int height, ImageObserver observer)
public boolean drawImage(Image image, int x, int y, Color background, ImageObserver observer)
public boolean drawImage(Image image, int x, int y, int width, int height, Color background, ImageObserver observer)
drawImage in class 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(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color background, ImageObserver observer)
public void copyArea(int x, int y, int width, int height, int destx, int desty)
public void dispose()
Graphics is using.public boolean isDrawingBuffer()
public void setDebugOptions(int options)
options - the debug optionspublic int getDebugOptions()