code: private CellRendererPane createCustomCellRendererPane() {
          return new CellRendererPane() {
              @Override
              public void paintComponent(Graphics graphics, Component component, Container container, int x, int y, int w, int h,
                      boolean shouldValidate) {
                  int     rowAtPoint = table.rowAtPoint(new Point(x, y));
                  boolean isSelected = table.isRowSelected(rowAtPoint);
  
                  if (component instanceof JComponent && component instanceof UIResource) {
                      JComponent jComponent = (JComponent) component;
  
                      jComponent.setOpaque(true);
                      jComponent.setBorder(isSelected ? getSelectedRowBorder() : getRowBorder());
                      jComponent.setBackground(isSelected ? jComponent.getBackground() : transparentColor);
  
                      if (isSelected) {
                          jComponent.setForeground(unwrap(table.getSelectionForeground()));
                          jComponent.setBackground(unwrap(table.getSelectionBackground()));
                      } else {
                          jComponent.setForeground(unwrap(table.getForeground()));
                          jComponent.setBackground(transparentColor);
                      }
                  }
  
                  super.paintComponent(graphics, component, container, x, y, w, h, shouldValidate);
              }
  
              /**
               * DOCUMENT ME!
               *
               * @param  c DOCUMENT ME!
               *
               * @return DOCUMENT ME!
               */
              private Color unwrap(Color c) {
                  if (c instanceof UIResource) {
                      return new Color(c.getRGB());
                  }
  
                  return c;
              }
  
              /**
               * @see javax.swing.JComponent#isOpaque()
               */
              @SuppressWarnings("unused")
              public boolean isOpaque(int x, int y) {
                  int rowAtPoint = table.rowAtPoint(new Point(x, y));
  
                  return table.isRowSelected(rowAtPoint) ? true : super.isOpaque();
              }
          };
      }
docs: Creates a custom {@link CellRendererPane} that sets the renderer
  component to be non-opqaque if the associated row isn't selected. This
  custom {@code CellRendererPane} is needed because a table UI delegate has
  no prepare renderer like {@link JTable} has.
  
  @return DOCUMENT ME!