所有类


javax.swing
类 DebugGraphics

java.lang.Object
  继承者 java.awt.Graphics
      继承者 javax.swing.DebugGraphics

public class DebugGraphics
   
   
   
   
   
extends Graphics

支持图形调试的图形子类。重写 Graphics 中的大多数方法。DebugGraphics 对象很少通过手工创建。它们通常在 JComponent 的 debugGraphicsOptions 因使用 setDebugGraphicsOptions() 方法而发生更改时自动创建。

注:必须关闭双缓冲来使用 DebugGraphics:RepaintManager repaintManager = RepaintManager.currentManager(component); repaintManager.setDoubleBufferingEnabled(false);

另请参见:
JComponent.setDebugGraphicsOptions(int), RepaintManager.currentManager(java.awt.Component), RepaintManager.setDoubleBufferingEnabled(boolean)

字段摘要
static intBUFFERED_OPTION
          在一个单独的 Frame 中显示已缓冲的操作。
static intFLASH_OPTION
          Flash 图形操作。
static intLOG_OPTION
          记录图形操作。
static intNONE_OPTION
          不要调试图形操作。
 
构造方法摘要
DebugGraphics()
          构造一个支持减速绘制的新调试图形上下文。
DebugGraphics(Graphics graphics)
          根据现有图形上下文构造一个调试图形上下文,该上下文支持减慢绘制。
DebugGraphics(Graphics graphics, JComponent component)
          根据现有图形上下文构造一个调试图形上下文,该上下文可以减慢指定组件的绘制。
 
方法摘要
 voidclearRect(int x, int y, int width, int height)
          重写 Graphics.clearRect
 voidclipRect(int x, int y, int width, int height)
          重写 Graphics.clipRect
 voidcopyArea(int x, int y, int width, int height, int destX, int destY)
          重写 Graphics.copyArea
 Graphicscreate()
          重写 Graphics.create 来返回一个 DebugGraphics 对象。
 Graphicscreate(int x, int y, int width, int height)
          重写 Graphics.create 来返回一个 DebugGraphics 对象。
 voiddispose()
          重写 Graphics.dispose
 voiddraw3DRect(int x, int y, int width, int height, boolean raised)
          重写 Graphics.draw3DRect
 voiddrawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
          重写 Graphics.drawArc
 voiddrawBytes(byte[] data, int offset, int length, int x, int y)
          重写 Graphics.drawBytes
 voiddrawChars(char[] data, int offset, int length, int x, int y)
          重写 Graphics.drawChars
 booleandrawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
          重写 Graphics.drawImage
 booleandrawImage(Image img, int x, int y, ImageObserver observer)
          重写 Graphics.drawImage
 booleandrawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
          重写 Graphics.drawImage
 booleandrawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
          重写 Graphics.drawImage
 booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
          重写 Graphics.drawImage
 booleandrawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
          重写 Graphics.drawImage
 voiddrawLine(int x1, int y1, int x2, int y2)
          重写 Graphics.drawLine
 voiddrawOval(int x, int y, int width, int height)
          重写 Graphics.drawOval
 voiddrawPolygon(int[] xPoints, int[] yPoints, int nPoints)
          重写 Graphics.drawPolygon
 voiddrawPolyline(int[] xPoints, int[] yPoints, int nPoints)
          重写 Graphics.drawPolyline
 voiddrawRect(int x, int y, int width, int height)
          重写 Graphics.drawRect
 voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
          重写 Graphics.drawRoundRect
 voiddrawString(AttributedCharacterIterator iterator, int x, int y)
          重写 Graphics.drawString
 voiddrawString(String aString, int x, int y)
          重写 Graphics.drawString
 voidfill3DRect(int x, int y, int width, int height, boolean raised)
          重写 Graphics.fill3DRect
 voidfillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
          重写 Graphics.fillArc
 voidfillOval(int x, int y, int width, int height)
          重写 Graphics.fillOval
 voidfillPolygon(int[] xPoints, int[] yPoints, int nPoints)
          重写 Graphics.fillPolygon
 voidfillRect(int x, int y, int width, int height)
          重写 Graphics.fillRect
 voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
          重写 Graphics.fillRoundRect
static ColorflashColor()
          返回用于 flash 绘制操作的 Color。
static intflashCount()
          绘制操作将要 flash 的次数。
static intflashTime()
          返回绘制操作 flash 的时间延迟。
 ShapegetClip()
          重写 Graphics.getClip
 RectanglegetClipBounds()
          重写 Graphics.getClipBounds
 ColorgetColor()
          返回用于文本绘制操作的 Color。
 intgetDebugOptions()
          返回此 DebugGraphics 的当前调试选项。
 FontgetFont()
          返回用于文本绘制操作的 Font。
 FontMetricsgetFontMetrics()
          重写 Graphics.getFontMetrics
 FontMetricsgetFontMetrics(Font f)
          重写 Graphics.getFontMetrics
 booleanisDrawingBuffer()
          返回 drawingBuffer 值。
static PrintStreamlogStream()
          返回 DebugGraphics 在其中记录绘制操作的流。
 voidsetClip(int x, int y, int width, int height)
          重写 Graphics.setClip
 voidsetClip(Shape clip)
          重写 Graphics.setClip
 voidsetColor(Color aColor)
          设置用于绘制和填充线条和图形的颜色。
 voidsetDebugOptions(int options)
          启用/禁用有关每个图形操作的诊断信息。
static voidsetFlashColor(Color flashColor)
          设置用于 flash 绘制操作的 Color。
static voidsetFlashCount(int flashCount)
          设置绘制操作将要 flash 的次数。
static voidsetFlashTime(int flashTime)
          设置绘制操作 flash 的时间延迟。
 voidsetFont(Font aFont)
          设置用于文本绘制操作的 Font。
static voidsetLogStream(PrintStream stream)
          设置 DebugGraphics 在其中记录绘制操作的流。
 voidsetPaintMode()
          重写 Graphics.setPaintMode
 voidsetXORMode(Color aColor)
          重写 Graphics.setXORMode
 voidtranslate(int x, int y)
          重写 Graphics.translate
 
从类 java.awt.Graphics 继承的方法
drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, hitClip, toString
 
从类 java.lang.Object 继承的方法
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

LOG_OPTION

public static final int LOG_OPTION
记录图形操作。

另请参见:
常量字段值

FLASH_OPTION

public static final int FLASH_OPTION
Flash 图形操作。

另请参见:
常量字段值

BUFFERED_OPTION

public static final int BUFFERED_OPTION
在一个单独的 Frame 中显示已缓冲的操作。

另请参见:
常量字段值

NONE_OPTION

public static final int NONE_OPTION
不要调试图形操作。

另请参见:
常量字段值
构造方法详细信息

DebugGraphics

public DebugGraphics()
构造一个支持减速绘制的新调试图形上下文。


DebugGraphics

public DebugGraphics(Graphics graphics,
                     JComponent component)
根据现有图形上下文构造一个调试图形上下文,该上下文可以减慢指定组件的绘制。

参数:
graphics - 要减慢的 Graphics 上下文
component - 要缓慢绘制的 JComponent

DebugGraphics

public DebugGraphics(Graphics graphics)
根据现有图形上下文构造一个调试图形上下文,该上下文支持减慢绘制。

参数:
graphics - 要减慢的 Graphics 上下文
方法详细信息

create

public Graphics create()
重写 Graphics.create 来返回一个 DebugGraphics 对象。

指定者:
Graphics 中的 create
返回:
新的图形上下文,它是此图形上下文的副本。

create

public Graphics create(int x,
                       int y,
                       int width,
                       int height)
重写 Graphics.create 来返回一个 DebugGraphics 对象。

覆盖:
Graphics 中的 create
参数:
x - x 坐标。
y - y 坐标。
width - 剪贴矩形的宽度。
height - 剪贴矩形的高度。
返回:
新的图形上下文。
另请参见:
Graphics.translate(int, int), Graphics.clipRect(int, int, int, int)