boolean toggleFlag = true;
int minY;
int maxY = -1;
for (int i = 0; i < blockArr.length; i++) {
// Get the image of this time block
Image backImg;
if (toggleFlag) {
backImg = mBackgroundImage1;
} else {
backImg = mBackgroundImage2;
}
// Get the y positions of this time block
minY = blockArr[i].mStartY;
if ((i + 1) < blockArr.length) {
maxY = blockArr[i + 1].mStartY;
} else {
maxY = tableHeight;
}
// Paint the background of this time block
int x = minCol * columnWidth;
for (int col = minCol; col <= maxCol; col++) {
fillImage(grp, x, minY, columnWidth, (maxY - minY), backImg, clipBounds);
x += columnWidth;
}
// Toggle the background
toggleFlag = !toggleFlag;
}
// Paint the rest if needed
if (maxY < tableHeight) {
minY = maxY + 1;
maxY = tableHeight;
// Get the image of this time block
Image backImg;
if (toggleFlag) {
backImg = mBackgroundImage1;
} else {
backImg = mBackgroundImage2;
}