public void paint(Graphics g) {
   Dimension size = getSize();
   int index = 0;
   if (column == viewIndexForColumn(header.getDraggedColumn())) {
     index = 2;
   } else if (isSelected || hasFocus || hasRollover) {
     index = 1;
   }
   skin.paintSkin(g, 0, 0, size.width - 1, size.height - 1, index);
   super.paint(g);
 }
示例#2
0
 @Override
 public Component getTableCellRendererComponent(
     JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
   super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
   String str = Objects.toString(value, "");
   if (highlighter.isHighlightableCell(row, column)) {
     setText("<html><u>" + str);
     setForeground(isSelected ? table.getSelectionForeground() : HIGHLIGHT);
     setBackground(isSelected ? table.getSelectionBackground().darker() : table.getBackground());
   } else {
     setText(str);
     setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
     setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
   }
   return this;
 }