Rectangle c = g.getClipBounds(); g.setClip(o.x, o.y, rfb.framebufferWidth, rfb.framebufferHeight); g.drawImage(softCursor, x0, y0, null); g.setClip(c.x, c.y, c.width, c.height);
offGraphics.setClip(o.x, o.y, rfb.framebufferWidth, rfb.framebufferHeight); offGraphics.drawImage(softCursor, x0, y0, null); offGraphics.setClip(null);
  public synchronized void paint(Graphics g) {    Point o = getImageOrigin();    Dimension d = getPreferredSize();    synchronized(memImage) {      g.drawImage(memImage, o.x, o.y, null);      // fill in background      if (o.x > 0 || o.y > 0) {        // left, right, top, bottom        Color c = g.getColor();        g.setColor(Color.white);        g.fillRect(0, 0, o.x, d.height);        g.fillRect(o.x + rfb.framebufferWidth, 0, d.width - (o.x +                   rfb.framebufferWidth), d.height);        g.fillRect(o.x, 0, rfb.framebufferWidth, o.y);        g.fillRect(o.x, o.y + rfb.framebufferHeight, rfb.framebufferWidth,                   d.height - (o.y + rfb.framebufferHeight));        g.setColor(DARK_GRAY);        g.drawRect(o.x - 1, o.y - 1, rfb.framebufferWidth + 1,                   rfb.framebufferHeight + 1);        g.setColor(c);      }    }    if (showSoftCursor) {      int x0 = cursorX - hotX, y0 = cursorY - hotY;      x0 += o.x;      y0 += o.y;      Rectangle r = new Rectangle(x0, y0, cursorWidth, cursorHeight);      if (r.intersects(g.getClipBounds())) {        Rectangle c = g.getClipBounds();        g.setClip(o.x, o.y, rfb.framebufferWidth, rfb.framebufferHeight);        g.drawImage(softCursor, x0, y0, null);        g.setClip(c.x, c.y, c.width, c.height);      }    }  }