void (Graphics g2, JComponent c) { final Graphics2D g = (Graphics2D)g2; final GraphicsConfig config = new GraphicsConfig(g); final Color bg = c.getBackground(); g.setPaint(bg); TableColumnModel model = header.getColumnModel(); final int h = header.getHeight(); final int w = model.getTotalColumnWidth(); g.fillRect(0, 0, w, h); JBColor bottomSeparatorColor = JBColor.namedColor("TableHeader.bottomSeparatorColor", ColorUtil.shift(bg, 0.75)); g.setPaint(bottomSeparatorColor); LinePainter2D.paint(g, 0, h - 1, w, h - 1); final Color lineColor = JBColor.namedColor("TableHeader.separatorColor", ColorUtil.shift(bg, 0.7)); config.restore(); int first = 0; int last = model.getColumnCount() - 1; if (last >= first) { Rectangle clip = g.getClipBounds(); int columnAtLeft = header.columnAtPoint(new Point(clip.x, clip.y)); int columnAtRight = header.columnAtPoint(new Point(clip.x + clip.width - 1, clip.y)); boolean focused = TableUtil.isFocused(header); boolean ltr = header.getComponentOrientation().isLeftToRight(); TableColumn draggedColumn = header.getDraggedColumn(); if (ltr) { if (columnAtLeft == -1) columnAtLeft = first; if (columnAtRight == -1) columnAtRight = last; Rectangle bounds = header.getHeaderRect(columnAtLeft); bounds.height--; // because of bottomSeparatorColor above for (int index = columnAtLeft; columnAtRight >= index; index++) { if (index != first) paintLine(g, bounds, lineColor); paintCell(g, bounds, model, index, focused, draggedColumn); bounds.x += bounds.width; } } else { if (columnAtRight == -1) columnAtRight = first; if (columnAtLeft == -1) columnAtLeft = last; Rectangle bounds = header.getHeaderRect(columnAtLeft); bounds.height--; // because of bottomSeparatorColor above for (int index = columnAtLeft; columnAtRight <= index; index--) { if (index != last) paintLine(g, bounds, lineColor); paintCell(g, bounds, model, index, focused, draggedColumn); bounds.x += bounds.width; } } if (draggedColumn != null) { int index = TableUtil.getColumnIndex(header, draggedColumn); Rectangle bounds = header.getHeaderRect(index); g.setColor(header.getParent().getBackground()); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); bounds.x += header.getDraggedDistance(); g.setColor(header.getBackground()); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); paintCell(g, bounds, draggedColumn, index, focused); } // remove all renderers rendererPane.removeAll(); } }