@Override
 public void paintComponent(Graphics g) {
   synchronized (renderer) {
     offscreenImage = renderer.getOffscreanImage();
     if (offscreenImage != null) {
       g.drawImage(offscreenImage, 0, 0, null);
     }
   }
   synchronized (cursor) {
     Image cursorImage = cursor.getImage();
     if (showCursor
         && cursorImage != null
         && g.getClipBounds().intersects(cursor.rX, cursor.rY, cursor.width, cursor.height)) {
       g.drawImage(cursorImage, cursor.rX, cursor.rY, null);
     }
   }
 }