/** Returns a DebugGraphics for use in buffering window. */
  private Graphics debugGraphics() {
    DebugGraphics debugGraphics;
    DebugGraphicsInfo info = info();
    JFrame debugFrame;

    if (info.debugFrame == null) {
      info.debugFrame = new JFrame();
      info.debugFrame.setSize(500, 500);
    }
    debugFrame = info.debugFrame;
    debugFrame.show();
    debugGraphics = new DebugGraphics(debugFrame.getGraphics());
    debugGraphics.setFont(getFont());
    debugGraphics.setColor(getColor());
    debugGraphics.translate(xOffset, yOffset);
    debugGraphics.setClip(getClipBounds());
    if (debugFlash()) {
      debugGraphics.setDebugOptions(FLASH_OPTION);
    }
    return debugGraphics;
  }
 /**
  * Constructs a debug graphics context from an existing graphics context that slows down drawing
  * for the specified component.
  *
  * @param graphics the Graphics context to slow down
  * @param component the JComponent to draw slowly
  */
 public DebugGraphics(Graphics graphics, JComponent component) {
   this(graphics);
   setDebugOptions(component.shouldDebugGraphics());
 }