public class javax.swing
DebugGraphics


Show All Login
Java SE 6
  
Extends: Graphics
Details
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);
version1.27 11/17/05
See also setDebugGraphicsOptions, currentManager, setDoubleBufferingEnabled


Fields
final public static int LOG_OPTION
Log graphics operations.
final public static int FLASH_OPTION
Flash graphics operations.
final public static int BUFFERED_OPTION
Show buffered operations in a separate Frame.
final public static int NONE_OPTION
Don't debug graphics operations.

Constructors
public DebugGraphics()
Constructs a new debug graphics context that supports slowed down drawing.
public DebugGraphics(Graphics graphics, JComponent component) Details
Constructs a debug graphics context from an existing graphics context that slows down drawing for the specified component.
graphicsthe Graphics context to slow down
componentthe JComponent to draw slowly
public DebugGraphics(Graphics graphics) Details
Constructs a debug graphics context from an existing graphics context that supports slowed down drawing.
graphicsthe Graphics context to slow down

Methods
public void clearRect(int x, int y, int width, int height)
Overrides Graphics.clearRect.
public void clipRect(int x, int y, int width, int height)
Overrides Graphics.clipRect.
public void copyArea(int x, int y, int width, int height, int destX, int destY)
Overrides Graphics.copyArea.
public Graphics create()
Overrides Graphics.create to return a DebugGraphics object.
public Graphics create(int x, int y, int width, int height)
Overrides Graphics.create to return a DebugGraphics object.
public void dispose()
Overrides Graphics.dispose.
public void draw3DRect(int x, int y, int width, int height, boolean raised)
Overrides Graphics.draw3DRect.
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Overrides Graphics.drawArc.
public void drawBytes(byte[] data, int offset, int length, int x, int y)
Overrides Graphics.drawBytes.
public void drawChars(char[] data, int offset, int length, int x, int y)
Overrides Graphics.drawChars.
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
Overrides Graphics.drawImage.
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
Overrides Graphics.drawImage.
public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
Overrides Graphics.drawImage.
public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
Overrides Graphics.drawImage.
public 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.
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)
Overrides Graphics.drawImage.
public void drawLine(int x1, int y1, int x2, int y2)
Overrides Graphics.drawLine.
public void drawOval(int x, int y, int width, int height)
Overrides Graphics.drawOval.
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
Overrides Graphics.drawPolygon.
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
Overrides Graphics.drawPolyline.
public void drawRect(int x, int y, int width, int height)
Overrides Graphics.drawRect.
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Overrides Graphics.drawRoundRect.
public void drawString(String aString, int x, int y)
Overrides Graphics.drawString.
public void drawString(AttributedCharacterIterator iterator, int x, int y)
Overrides Graphics.drawString.
public void fill3DRect(int x, int y, int width, int height, boolean raised)
Overrides Graphics.fill3DRect.
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
Overrides Graphics.fillArc.
public void fillOval(int x, int y, int width, int height)
Overrides Graphics.fillOval.
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
Overrides Graphics.fillPolygon.
public void fillRect(int x, int y, int width, int height)
Overrides Graphics.fillRect.
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
Overrides Graphics.fillRoundRect.
public static Color flashColor() Details
Returns the Color used to flash drawing operations.
See also setFlashColor
public static int flashCount() Details
Returns the number of times that drawing operations will flash.
See also setFlashCount
public static int flashTime() Details
Returns the time delay of drawing operation flashing.
See also setFlashTime
public static PrintStream logStream() Details
Returns the stream to which the DebugGraphics logs drawing operations.
See also setLogStream
public void translate(int x, int y)
Overrides Graphics.translate.

Properties
public void setClip(int x, int y, int width, int height)
Overrides Graphics.setClip.
public void setClip(Shape clip)
Overrides Graphics.setClip.
public Shape getClip()
Overrides Graphics.getClip.
public Rectangle getClipBounds()
Overrides Graphics.getClipBounds.
public void setColor(Color aColor)
Sets the color to be used for drawing and filling lines and shapes.
public Color getColor() Details
Returns the Color used for text drawing operations.
See also setColor
public void setDebugOptions(int options)
Enables/disables diagnostic information about every graphics operation. The value of options indicates how this information should be displayed. LOG_OPTION causes a text message to be printed. FLASH_OPTION causes the drawing to flash several times. BUFFERED_OPTION creates a new Frame that shows each operation on an offscreen buffer. The value of options is bitwise OR'd into the current value. To disable debugging use NONE_OPTION.
public int getDebugOptions() Details
Returns the current debugging options for this DebugGraphics.
See also setDebugOptions
public boolean isDrawingBuffer() Details
Returns the drawingBuffer value.
returntrue if this object is drawing from a Buffer
public static void setFlashColor(Color flashColor)
Sets the Color used to flash drawing operations.
public static void setFlashCount(int flashCount)
Sets the number of times that drawing operations will flash.
public static void setFlashTime(int flashTime)
Sets the time delay of drawing operation flashing.
public void setFont(Font aFont)
Sets the Font used for text drawing operations.
public Font getFont() Details
Returns the Font used for text drawing operations.
See also setFont
public FontMetrics getFontMetrics()
Overrides Graphics.getFontMetrics.
public FontMetrics getFontMetrics(Font f)
Overrides Graphics.getFontMetrics.
public static void setLogStream(PrintStream stream)
Sets the stream to which the DebugGraphics logs drawing operations.
public void setPaintMode()
Overrides Graphics.setPaintMode.
public void setXORMode(Color aColor)
Overrides Graphics.setXORMode.