} catch (Exception e) {
logger.error(e, e);
}
ListCellRenderer renderer = list.getCellRenderer();
ListModel dataModel = list.getModel();
ListSelectionModel selModel = list.getSelectionModel();
if ((renderer == null) || (dataModel.getSize() == 0))
return;
// Compute the area we're going to paint in terms of the affected
// columns/rows (firstPaintColumn, firstPaintRow, lastPaintColumn,
// lastPaintRow), and the clip bounds.
Rectangle paintBounds = g.getClipBounds();
int firstPaintColumn = convertXToColumn(paintBounds.x);
int firstPaintRow = convertYToRow(paintBounds.y);
int lastPaintColumn = convertXToColumn((paintBounds.x+ paintBounds.width) - 1);
int lastPaintRow = convertYToRow((paintBounds.y + paintBounds.height) - 1);
if (firstPaintRow == -1)
firstPaintRow = 0;
if (lastPaintRow == -1)
lastPaintRow = (dataModel.getSize()-1)/columnsPerRow;
if (firstPaintColumn == -1)
firstPaintColumn = 0;
if (lastPaintColumn == -1)
lastPaintColumn = columnsPerRow-1;
Rectangle itemBounds = getCellBoundsPerColumnRow(list, firstPaintColumn, firstPaintRow);
if (itemBounds == null)
return;
int leadIndex = list.getLeadSelectionIndex();
int startItemBoundX = itemBounds.x;
for(int row = firstPaintRow; row <= lastPaintRow; row++) {
itemBounds.x = startItemBoundX;
for(int column = firstPaintColumn; column <= lastPaintColumn; column++) {
int index = row * columnsPerRow + column;
if(index >= dataModel.getSize())
break;
itemBounds.width = getItemWidth(index);
itemBounds.height = getItemHeight(index);