Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
java.awt.Graphics
javax.swing.DebugGraphics
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.
Field Summary | |
static int |
|
static int |
|
static int |
|
static int |
|
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
Graphics |
|
Graphics |
|
void |
|
void |
|
void |
|
void |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
static Color |
|
static int |
|
static int |
|
Shape |
|
Rectangle |
|
Color |
|
int |
|
Font |
|
FontMetrics |
|
FontMetrics |
|
boolean |
|
static PrintStream |
|
void |
|
void | |
void | |
void |
|
static void |
|
static void |
|
static void |
|
void | |
static void |
|
void |
|
void |
|
void |
|
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 , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public DebugGraphics(Graphics graphics)
Creates aDebugGraphics
object.
- Parameters:
graphics
- TheGraphics
object to wrap
public DebugGraphics(Graphics graphics, JComponent component)
Creates aDebugGraphics
object.
- Parameters:
graphics
- TheGraphics
object to wrapcomponent
- TODO
public void clearRect(int x, int y, int width, int height)
clearRect
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangle
public void clipRect(int x, int y, int width, int height)
Intersects the current clip region with the given region.
- Parameters:
x
- The x-position of the regiony
- The y-position of the regionwidth
- The width of the regionheight
- The height of the region
public void copyArea(int x, int y, int width, int height, int destx, int desty)
copyArea
- Parameters:
x
- 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 area
public Graphics create()
Creates a overridesGraphics.create
to create aDebugGraphics
object.
- Returns:
- a new
DebugGraphics
object.
public Graphics create(int x, int y, int width, int height)
Creates a overridesGraphics.create
to create aDebugGraphics
object.
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height
- Returns:
- a new
DebugGraphics
object.
public void draw3DRect(int x, int y, int width, int height, boolean raised)
draw3DRect
- Overrides:
- draw3DRect in interface Graphics
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangleraised
- TODO
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
drawArc
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the heightstartAngle
- TODOarcAngle
- TODO
public void drawBytes(byte[] data, int offset, int length, int x, int y)
drawBytes
- Parameters:
data
- TODOoffset
- TODOlength
- TODOx
- the x coordinatey
- the y coordinate
public void drawChars(char[] data, int offset, int length, int x, int y)
drawChars
- Parameters:
data
- array of characters to drawoffset
- offset in arraylength
- number of characters in array to drawx
- x-positiony
- y-position
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)
drawImage
- Parameters:
image
- 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 observer
- Returns:
- boolean
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
drawImage
- Parameters:
image
- The image to drawdx1
- TODOdy1
- TODOdx2
- TODOdy2
- TODOsx1
- TODOsy1
- TODOsx2
- TODOsy2
- TODOobserver
- The image observer
- Returns:
- boolean
public boolean drawImage(Image image, int x, int y, int width, int height, Color background, ImageObserver observer)
drawImage
- Parameters:
image
- 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 observer
- Returns:
- boolean
public boolean drawImage(Image image, int x, int y, int width, int height, ImageObserver observer)
drawImage
- Parameters:
image
- 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 observer
- Returns:
- boolean
public boolean drawImage(Image image, int x, int y, Color background, ImageObserver observer)
drawImage
- Parameters:
image
- The image to drawx
- The x positiony
- The y positionbackground
- The color for the background in the opaque regions of the imageobserver
- The image observer
- Returns:
- boolean
public boolean drawImage(Image image, int x, int y, ImageObserver observer)
drawImage
- Parameters:
image
- The image to drawx
- The x positiony
- The y positionobserver
- The image observer
- Returns:
- boolean
public void drawLine(int x1, int y1, int x2, int y2)
drawLine
- Parameters:
x1
- The x-position of the starty1
- The y-position of the startx2
- The x-position of the endy2
- The y-position of the end
public void drawOval(int x, int y, int width, int height)
drawOval
- Parameters:
x
- the x coordinatey
- the y coordiantewidth
- the widthheight
- the height
public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
drawPolygon
- Parameters:
xpoints
- TODOypoints
- TODOnpoints
- TODO
public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
drawPolyline
- Parameters:
xpoints
- TODOypoints
- TODOnpoints
- TODO
public void drawRect(int x, int y, int width, int height)
Draws a rectangle.
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangle
public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
drawRoundRect
- Overrides:
- drawRoundRect in interface Graphics
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectanglearcWidth
- TODOarcHeight
- TODO
public void drawString(String string, int x, int y)
drawString
- Overrides:
- drawString in interface Graphics
- Parameters:
string
- the stringx
- the x coordinatey
- the y coordinate
public void drawString(AttributedCharacterIterator iterator, int x, int y)
drawString
- Overrides:
- drawString in interface Graphics
- Parameters:
iterator
- TODOx
- the x coordinatey
- the y coordinate
public void fill3DRect(int x, int y, int width, int height, boolean raised)
fill3DRect
- Overrides:
- fill3DRect in interface Graphics
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangleraised
- TODO
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
fillArc
- Parameters:
x
- the coordinatey
- the y coordinatewidth
- the widthheight
- the heightstartAngle
- TODOarcAngle
- TODO
public void fillOval(int x, int y, int width, int height)
fillOval
- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the height
public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
fillPolygon
- Parameters:
xpoints
- TODOypoints
- TODOnpoints
- TODO
public void fillRect(int x, int y, int width, int height)
Draws a filled rectangle.
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectangle
public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
fillRoundRect
- Overrides:
- fillRoundRect in interface Graphics
- Parameters:
x
- The x-position of the rectangley
- The y-position of the rectanglewidth
- The width of the rectangleheight
- The height of the rectanglearcWidth
- TODOarcHeight
- TODO
public Rectangle getClipBounds()
getClipBounds
- Overrides:
- getClipBounds in interface Graphics
- Returns:
- Rectangle
public FontMetrics getFontMetrics()
Returns the font metrics of the current font.
- Overrides:
- getFontMetrics in interface Graphics
- Returns:
- a
FontMetrics
object
public FontMetrics getFontMetrics(Font font)
Returns the font metrics for a given font.
- Overrides:
- getFontMetrics in interface Graphics
- Parameters:
font
- the font to get the metrics for
- Returns:
- a
FontMetrics
object
public static PrintStream logStream()
logStream
- Returns:
- The
PrintStream
to write logging messages to
public void setClip(int x, int y, int width, int height)
Sets the clipping region.
- Parameters:
x
- The x-position of the regiony
- The y-position of the regionwidth
- The width of the regionheight
- The height of the region
public void setClip(Shape shape)
Sets the current clipping region
- Parameters:
shape
- The clippin region
public void setColor(Color color)
Sets the color to draw stuff with.
- Parameters:
color
- The color
public void setDebugOptions(int options)
setDebugOptions
- Parameters:
options
- the debug options
public static void setFlashColor(Color color)
setFlashColor
- Parameters:
color
- the color to use for flashing
public static void setFlashCount(int count)
setFlashCount
- Parameters:
count
- The number of flashes
public static void setFlashTime(int time)
setFlashTime
- Parameters:
time
- The time in milliseconds
public static void setLogStream(PrintStream stream)
setLogStream
- Parameters:
stream
- The currently setPrintStream
.
public void setXORMode(Color color)
setXORMode
- Overrides:
- setXORMode in interface Graphics
- Parameters:
color
- the color
public void translate(int x, int y)
translate
- Parameters:
x
- the x coordinatey
- the y coordinate