模块 java.desktop

类 DebugGraphics

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

public class DebugGraphics extends Graphics
支持图形调试的图形子类。重写 Graphics 中的大多数方法。 DebugGraphics 对象很少是手动创建的。当使用 setDebugGraphicsOptions() 方法更改 JComponent 的 debugGraphicsOptions 时,它们最常自动创建。

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

自从:
1.2
参见:
  • 字段摘要

    字段
    修饰符和类型
    Field
    描述
    static final int
    在单独的 Frame 中显示缓冲操作。
    static final int
    Flash图形操作。
    static final int
    记录图形操作。
    static final int
    不要调试图形操作。
  • 构造方法总结

    构造方法
    构造方法
    描述
    构造一个新的调试图形上下文,它支持减慢绘图速度。
    从支持减慢绘图的现有图形上下文构造调试图形上下文。
    DebugGraphics(Graphics graphics, JComponent component)
    从现有图形上下文构造调试图形上下文,这会减慢指定组件的绘制速度。
  • 方法总结

    修饰符和类型
    方法
    描述
    void
    clearRect(int x, int y, int width, int height)
    重写 Graphics.clearRect
    void
    clipRect(int x, int y, int width, int height)
    重写 Graphics.clipRect
    void
    copyArea(int x, int y, int width, int height, int destX, int destY)
    重写 Graphics.copyArea
    覆盖 Graphics.create 以返回 DebugGraphics 对象。
    create(int x, int y, int width, int height)
    覆盖 Graphics.create 以返回 DebugGraphics 对象。
    void
    重写 Graphics.dispose
    void
    draw3DRect(int x, int y, int width, int height, boolean raised)
    重写 Graphics.draw3DRect
    void
    drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
    重写 Graphics.drawArc
    void
    drawBytes(byte[] data, int offset, int length, int x, int y)
    重写 Graphics.drawBytes
    void
    drawChars(char[] data, int offset, int length, int x, int y)
    重写 Graphics.drawChars
    boolean
    drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
    重写 Graphics.drawImage
    boolean
    drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer)
    重写 Graphics.drawImage
    boolean
    drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
    重写 Graphics.drawImage
    boolean
    drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
    重写 Graphics.drawImage
    boolean
    drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
    重写 Graphics.drawImage
    boolean
    drawImage(Image img, int x, int y, ImageObserver observer)
    重写 Graphics.drawImage
    void
    drawLine(int x1, int y1, int x2, int y2)
    重写 Graphics.drawLine
    void
    drawOval(int x, int y, int width, int height)
    重写 Graphics.drawOval
    void
    drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
    重写 Graphics.drawPolygon
    void
    drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
    重写 Graphics.drawPolyline
    void
    drawRect(int x, int y, int width, int height)
    重写 Graphics.drawRect
    void
    drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
    重写 Graphics.drawRoundRect
    void
    drawString(String aString, int x, int y)
    重写 Graphics.drawString
    void
    drawString(AttributedCharacterIterator iterator, int x, int y)
    重写 Graphics.drawString
    void
    fill3DRect(int x, int y, int width, int height, boolean raised)
    重写 Graphics.fill3DRect
    void
    fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
    重写 Graphics.fillArc
    void
    fillOval(int x, int y, int width, int height)
    重写 Graphics.fillOval
    void
    fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
    重写 Graphics.fillPolygon
    void
    fillRect(int x, int y, int width, int height)
    重写 Graphics.fillRect
    void
    fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
    重写 Graphics.fillRoundRect
    static Color
    返回用于闪烁绘图操作的颜色。
    static int
    返回绘图操作闪烁的次数。
    static int
    返回绘图操作闪烁的时间延迟。
    重写 Graphics.getClip
    重写 Graphics.getClipBounds
    返回用于文本绘制操作的颜色。
    int
    返回此 DebugGraphics 的当前调试选项。
    返回用于文本绘制操作的字体。
    重写 Graphics.getFontMetrics
    重写 Graphics.getFontMetrics
    boolean
    返回绘图缓冲区值。
    static PrintStream
    返回 DebugGraphics 记录绘图操作的流。
    void
    setClip(int x, int y, int width, int height)
    重写 Graphics.setClip
    void
    setClip(Shape clip)
    重写 Graphics.setClip
    void
    setColor(Color aColor)
    设置用于绘制和填充线条和形状的颜色。
    void
    setDebugOptions(int options)
    启用/禁用有关每个图形操作的诊断信息。
    static void
    setFlashColor(Color flashColor)
    设置用于闪烁绘图操作的颜色。
    static void
    setFlashCount(int flashCount)
    设置绘图操作闪烁的次数。
    static void
    setFlashTime(int flashTime)
    设置绘图操作闪烁的时间延迟。
    void
    setFont(Font aFont)
    设置用于文本绘制操作的字体。
    static void
    设置 DebugGraphics 记录绘图操作的流。
    void
    重写 Graphics.setPaintMode
    void
    setXORMode(Color aColor)
    重写 Graphics.setXORMode
    void
    translate(int x, int y)
    重写 Graphics.translate

    在类 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 - 要减慢的图形上下文
      component - 缓慢绘制的 JComponent
    • DebugGraphics

      public DebugGraphics(Graphics  graphics)
      从支持减慢绘图的现有图形上下文构造调试图形上下文。
      参数:
      graphics - 要减慢的图形上下文
  • 方法详情