void (Graphics g, int row, Rectangle rowBounds, ListCellRenderer renderer, ListModel model, ListSelectionModel selectionModel, int leadSelectionIndex) { if (!(0 <= row && row < model.getSize())) return; boolean selected = selectionModel.isSelectedIndex(row); Rectangle paintBounds = myPaintBounds; if (paintBounds != null) { boolean focused = row == leadSelectionIndex && (!list.isFocusable() || list.hasFocus()); Object value = model.getElementAt(row); Color background = getBackground(list, value, row, selected); if (background != null) { g.setColor(background); g.fillRect(rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height); } Component component = renderer.getListCellRendererComponent(list, value, row, selected, focused); if (component != null) { if (rendererPane != component.getParent()) rendererPane.add(component); g.setClip(paintBounds.x, paintBounds.y, paintBounds.width, paintBounds.height); paintRenderer(g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height, list, component); g.clipRect(rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height); } } try { super.paintCell(g, row, rowBounds, renderer, model, selectionModel, leadSelectionIndex); } catch (IndexOutOfBoundsException exception) { LOG.error("model asynchronously modified: " + model.getClass() + " in " + list, exception); } if (!isMac && g instanceof Graphics2D && row == leadSelectionIndex && list.hasFocus()) { int x = rowBounds.x; int width = rowBounds.width; if (JList.VERTICAL == list.getLayoutOrientation()) { x = 0; width = list.getWidth(); JViewport viewport = ComponentUtil.getViewport(list); if (viewport != null) { x = -list.getX(); width = viewport.getWidth(); } } if (!selected) { g.setColor(UIUtil.getListSelectionBackground(true)); g.setClip(x, rowBounds.y, width, rowBounds.height); DRAW.paint((Graphics2D)g, x, rowBounds.y, width, rowBounds.height, 0); } else if (isLeadSelectionNeeded(list, row)) { g.setColor(UIUtil.getListBackground()); g.setClip(x, rowBounds.y, width, rowBounds.height); DRAW.paint((Graphics2D)g, x + 1, rowBounds.y + 1, width - 2, rowBounds.height - 2, 0); } } }