if (comp instanceof JTextField) { Rectangle oldClip = g.getClipBounds(); g.translate(bounds.x, bounds.y); g.clipRect(0, 0, bounds.width, bounds.height); ((JTextField)comp).getCaret().paint(g); g.translate(-bounds.x, -bounds.y); g.setClip(oldClip); }
  void paintCell(Graphics g, int row, int col, Rectangle bounds,                 TableCellRenderer rend, TableModel data,                 int rowLead, int colLead)  {    Component comp = table.prepareRenderer(rend, row, col);    rendererPane.paintComponent(g, comp, table, bounds);        // FIXME: this is manual painting of the Caret, why doesn't the     // JTextField take care of this itself?    if (comp instanceof JTextField)      {        Rectangle oldClip = g.getClipBounds();        g.translate(bounds.x, bounds.y);        g.clipRect(0, 0, bounds.width, bounds.height);        ((JTextField)comp).getCaret().paint(g);        g.translate(-bounds.x, -bounds.y);        g.setClip(oldClip);      }  }