public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value != null) setText(value.toString()); if (isSelected) setBackground(table.getSelectionBackground()); else { setBackground(table.getBackground()); if (row == highlightedRowNum) setBackground(ColorUtil.setAlpha(table.getSelectionBackground(), 150)); } return this; }
protected void paintComponent(Graphics g) { Insets ins = new Insets(5, 5, 5, 5); if (colorwell != null) { ColorUtil.tileStretchPaint(g, this, colorwell, ins); } // 0, 23, 255 = 235o, 100%, 100% // 31, 0, 204 = 249o, 100%, 80% g.setColor(ColorUtil.removeAlpha(getBackground())); g.fillRect( ins.left, ins.top, getWidth() - ins.left - ins.right, getHeight() - ins.top - ins.bottom); g.setColor(ColorUtil.setBrightness(getBackground(), 0.85f)); g.drawRect( ins.left, ins.top, getWidth() - ins.left - ins.right - 1, getHeight() - ins.top - ins.bottom - 1); g.drawRect( ins.left + 1, ins.top + 1, getWidth() - ins.left - ins.right - 3, getHeight() - ins.top - ins.bottom - 3); }