Browse Source

Ensure height of list cell is >= 0. Fixes #204.

pull/214/head v2.4.3-rc1
weisj 4 years ago
parent
commit
9233fe29c5
  1. 9
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java

9
core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java

@ -150,13 +150,14 @@ public class DarkListUI extends DarkListUIBridge implements CellConstants {
&& colCounter * rowsPerColumn + rowCount >= dataModel.getSize();
int bgWidth = lastColumn ? maxX - rowBounds.x : 0;
int maxRow = lastColumn ? Integer.MAX_VALUE : rowCount;
while (rowBounds.y < maxY) {
rowBounds.height = getHeight(colCounter, row);
if (rowBounds.height <= 0) {
rowBounds.height = colCounter >= 1
? getHeight(colCounter - 1, row)
: getRowHeight(row);
for (int column = colCounter - 1; rowBounds.height <= 0 && column >= 0; column--) {
rowBounds.height = getHeight(colCounter - 1, row);
}
if (rowBounds.height <= 0) rowBounds.height = getHeight(0, 0);
g.setClip(rowBounds.x, rowBounds.y, bgWidth > 0 ? bgWidth : rowBounds.width, rowBounds.height);
g.clipRect(paintBounds.x, paintBounds.y, paintBounds.width, paintBounds.height);
int cellIndex = row < maxRow && colCounter <= endColumn ? index : -1;

Loading…
Cancel
Save