if (table.getSelectionModel().getLeadSelectionIndex() == row && table.getColumnModel().getSelectionModel(). getLeadSelectionIndex() == col) ((JComponent) comp).setBorder(highlightCellBorder); else ((JComponent) comp).setBorder(cellBorder);
  void paintCell(Graphics g, int row, int col, Rectangle bounds,                 TableCellRenderer rend, TableModel data,                 int rowLead, int colLead)  {    boolean isSel = table.isCellSelected(row, col);    boolean hasFocus = (table.getSelectionModel().getLeadSelectionIndex() == row) && table.hasFocus();    Component comp = rend.getTableCellRendererComponent(table,                                                       data.getValueAt(row, col),                                                       isSel, hasFocus, row, col);        // If the cell is the lead selection then highlight its border    if (table.getSelectionModel().getLeadSelectionIndex() == row        && table.getColumnModel().getSelectionModel().        getLeadSelectionIndex() == col)      ((JComponent) comp).setBorder(highlightCellBorder);    else      ((JComponent) comp).setBorder(cellBorder);             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);      }  }