public class DebugGraphics extends Graphics
NOTE: You must turn off double buffering to use DebugGraphics: RepaintManager repaintManager = RepaintManager.currentManager(component); repaintManager.setDoubleBufferingEnabled(false);
Modifier and Type | Field | Description |
---|---|---|
static int |
BUFFERED_OPTION |
Show buffered operations in a separate
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 | Description |
---|---|
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.
|
Modifier and Type | Method | Description |
---|---|---|
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 . |
drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, hitClip, toString
public static final int LOG_OPTION
public static final int FLASH_OPTION
public static final int BUFFERED_OPTION
Frame
.public static final int NONE_OPTION
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 downpublic 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.create
in class Graphics
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)
setFont
in class Graphics
aFont
- the font.Graphics.getFont()
,
Graphics.drawString(java.lang.String, int, int)
,
Graphics.drawBytes(byte[], int, int, int, int)
,
Graphics.drawChars(char[], int, int, int, int)
public Font getFont()
getFont
in class Graphics
setFont(java.awt.Font)