This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class DebugGraphics

java.lang.Object extended by java.awt.Graphics extended by javax.swing.DebugGraphics

public class DebugGraphics
extends Graphics

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);


Field Summary
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 Summary

          Constructs a new debug graphics context that supports slowed down drawing.

          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

          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

          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

          Returns the Color used to flash drawing operations.
static int

          Returns the number of times that drawing operations will flash.
static int

          Returns the time delay of drawing operation flashing.
 Shape

          Overrides Graphics.getClip.
 Rectangle

          Overrides Graphics.getClipBounds.
 Color

          Returns the Color used for text drawing operations.
 int

          Returns the current debugging options for this DebugGraphics.
 Font

          Returns the Font used for text drawing operations.
 FontMetrics

          Overrides Graphics.getFontMetrics.
 FontMetrics

          Overrides Graphics.getFontMetrics.
 boolean

          Returns the drawingBuffer value.
static PrintStream

          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

          Sets the stream to which the DebugGraphics logs drawing operations.
 void

          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
clearRect, clipRect, copyArea, create, create, dispose, draw3DRect, drawArc, drawBytes, drawChars, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fill3DRect, fillArc, fillOval, fillPolygon, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getClipBounds, getClipRect, getColor, getFont, getFontMetrics, getFontMetrics, hitClip, setClip, setClip, setColor, setFont, setPaintMode, setXORMode, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFERED_OPTION

public static final int BUFFERED_OPTION
Show buffered operations in a separate Frame.

FLASH_OPTION

public static final int FLASH_OPTION
Flash graphics operations.

LOG_OPTION

public static final int LOG_OPTION
Log graphics operations.

NONE_OPTION

public static final int NONE_OPTION
Don't debug graphics operations.
Constructor Detail

DebugGraphics

public DebugGraphics()
Constructs a new debug graphics context that supports slowed down drawing.


DebugGraphics

public DebugGraphics(Graphics graphics)
Constructs a debug graphics context from an existing graphics context that supports slowed down drawing.

Parameters:
graphics - the Graphics context to slow down

DebugGraphics

public DebugGraphics(Graphics graphics,
                     JComponent component)
Constructs a debug graphics context from an existing graphics context that slows down drawing for the specified component.

Parameters:
graphics - the Graphics context to slow down
component - the JComponent to draw slowly
Method Detail

clearRect

public void clearRect(int x,
                      int y,
                      int width,
                      int height)
Overrides Graphics.clearRect.

Overrides:
clearRect in class Graphics
Parameters:
x
y
width
height

clipRect

public void clipRect(int x,
                     int y,
                     int width,
                     int height)
Overrides Graphics.clipRect.

Overrides:
clipRect in class Graphics
Parameters:
x
y
width
height

copyArea

public void copyArea(int x,
                     int y,
                     int width,
                     int height,
                     int destX,
                     int destY)
Overrides Graphics.copyArea.

Overrides:
copyArea in class Graphics
Parameters:
x
y
width
height
destX
destY

create

public Graphics create()
Overrides Graphics.create to return a DebugGraphics object.

Overrides:
create in class Graphics

create

public Graphics create(int x,
                       int y,
                       int width,
                       int height)
Overrides Graphics.create to return a DebugGraphics object.

Overrides:
create in class Graphics
Parameters:
x
y
width
height

dispose

public void dispose()
Overrides Graphics.dispose.

Overrides:
dispose in class Graphics

draw3DRect

public void draw3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Overrides Graphics.draw3DRect.

Overrides:
draw3DRect in class Graphics
Parameters:
x
y
width
height
raised

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Overrides Graphics.drawArc.

Overrides:
drawArc in class Graphics
Parameters:
x
y
width
height
startAngle
arcAngle

drawBytes

public void drawBytes(byte[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Overrides Graphics.drawBytes.

Overrides:
drawBytes in class Graphics
Parameters:
data
offset
length
x
y

drawChars

public void drawChars(char[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Overrides Graphics.drawChars.

Overrides:
drawChars in class Graphics
Parameters:
data
offset
length
x
y

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         Color bgcolor,
                         ImageObserver observer)
Overrides Graphics.drawImage.

Overrides:
drawImage in class Graphics
Parameters:
img
x
y
bgcolor
observer

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         ImageObserver observer)
Overrides Graphics.drawImage.

Overrides:
drawImage in class Graphics
Parameters:
img
x
y
observer

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         Color bgcolor,
                         ImageObserver observer)
Overrides Graphics.drawImage.

Overrides:
drawImage in class Graphics
Parameters:
img
x
y
width
height
bgcolor
observer

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         ImageObserver observer)
Overrides Graphics.drawImage.

Overrides:
drawImage in class Graphics
Parameters:
img
x
y
width
height
observer

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.

Overrides:
drawImage in class Graphics
Parameters:
img
dx1
dy1
dx2
dy2
sx1
sy1
sx2
sy2
bgcolor
observer

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.

Overrides:
drawImage in class Graphics
Parameters:
img
dx1
dy1
dx2
dy2
sx1
sy1
sx2
sy2
observer

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Overrides Graphics.drawLine.

Overrides:
drawLine in class Graphics
Parameters:
x1
y1
x2
y2

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Overrides Graphics.drawOval.

Overrides:
drawOval in class Graphics
Parameters:
x
y
width
height

drawPolygon

public void drawPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Overrides Graphics.drawPolygon.

Overrides:
drawPolygon in class Graphics
Parameters:
xPoints
yPoints
nPoints

drawPolyline

public void drawPolyline(int[] xPoints,
                         int[] yPoints,
                         int nPoints)
Overrides Graphics.drawPolyline.

Overrides:
drawPolyline in class Graphics
Parameters:
xPoints
yPoints
nPoints

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
Overrides Graphics.drawRect.

Overrides:
drawRect in class Graphics
Parameters:
x
y
width
height

drawRoundRect

public void drawRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Overrides Graphics.drawRoundRect.

Overrides:
drawRoundRect in class Graphics
Parameters:
x
y
width
height
arcWidth
arcHeight

drawString

public void drawString(AttributedCharacterIterator iterator,
                       int x,
                       int y)
Overrides Graphics.drawString.

Overrides:
drawString in class Graphics
Parameters:
iterator
x
y

drawString

public void drawString(String aString,
                       int x,
                       int y)
Overrides Graphics.drawString.

Overrides:
drawString in class Graphics
Parameters:
aString
x
y

fill3DRect

public void fill3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Overrides Graphics.fill3DRect.

Overrides:
fill3DRect in class Graphics
Parameters:
x
y
width
height
raised

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Overrides Graphics.fillArc.

Overrides:
fillArc in class Graphics
Parameters:
x
y
width
height
startAngle
arcAngle

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Overrides Graphics.fillOval.

Overrides:
fillOval in class Graphics
Parameters:
x
y
width
height

fillPolygon

public void fillPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Overrides Graphics.fillPolygon.

Overrides:
fillPolygon in class Graphics
Parameters:
xPoints
yPoints
nPoints

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
Overrides Graphics.fillRect.

Overrides:
fillRect in class Graphics
Parameters:
x
y
width
height

fillRoundRect

public void fillRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Overrides Graphics.fillRoundRect.

Overrides:
fillRoundRect in class Graphics
Parameters:
x
y
width
height
arcWidth
arcHeight

flashColor

public static Color flashColor()
Returns the Color used to flash drawing operations.


flashCount

public static int flashCount()
Returns the number of times that drawing operations will flash.


flashTime

public static int flashTime()
Returns the time delay of drawing operation flashing.


getClip

public Shape getClip()
Overrides Graphics.getClip.

Overrides:
getClip in class Graphics

getClipBounds

public Rectangle getClipBounds()
Overrides Graphics.getClipBounds.

Overrides:
getClipBounds in class Graphics

getColor

public Color getColor()
Returns the Color used for text drawing operations.

Overrides:
getColor in class Graphics

getDebugOptions

public int getDebugOptions()
Returns the current debugging options for this DebugGraphics.


getFont

public Font getFont()
Returns the Font used for text drawing operations.

Overrides:
getFont in class Graphics

getFontMetrics

public FontMetrics getFontMetrics()
Overrides Graphics.getFontMetrics.

Overrides:
getFontMetrics in class Graphics

getFontMetrics

public FontMetrics getFontMetrics(Font f)
Overrides Graphics.getFontMetrics.

Overrides:
getFontMetrics in class Graphics
Parameters:
f

isDrawingBuffer

public boolean isDrawingBuffer()
Returns the drawingBuffer value.

Returns:
true if this object is drawing from a Buffer

logStream

public static PrintStream logStream()
Returns the stream to which the DebugGraphics logs drawing operations.


setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
Overrides Graphics.setClip.

Overrides:
setClip in class Graphics
Parameters:
x
y
width
height

setClip

public void setClip(Shape clip)
Overrides Graphics.setClip.

Overrides:
setClip in class Graphics
Parameters:
clip

setColor

public void setColor(Color aColor)
Sets the color to be used for drawing and filling lines and shapes.

Overrides:
setColor in class Graphics
Parameters:
aColor

setDebugOptions

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.

Parameters:
options

setFlashColor

public static void setFlashColor(Color flashColor)
Sets the Color used to flash drawing operations.

Parameters:
flashColor

setFlashCount

public static void setFlashCount(int flashCount)
Sets the number of times that drawing operations will flash.

Parameters:
flashCount

setFlashTime

public static void setFlashTime(int flashTime)
Sets the time delay of drawing operation flashing.

Parameters:
flashTime

setFont

public void setFont(Font aFont)
Sets the Font used for text drawing operations.

Overrides:
setFont in class Graphics
Parameters:
aFont

setLogStream

public static void setLogStream(PrintStream stream)
Sets the stream to which the DebugGraphics logs drawing operations.

Parameters:
stream

setPaintMode

public void setPaintMode()
Overrides Graphics.setPaintMode.

Overrides:
setPaintMode in class Graphics

setXORMode

public void setXORMode(Color aColor)
Overrides Graphics.setXORMode.

Overrides:
setXORMode in class Graphics
Parameters:
aColor

translate

public void translate(int x,
                      int y)
Overrides Graphics.translate.

Overrides:
translate in class Graphics
Parameters:
x
y


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.