}
}
// Using the information of the clip bounds, we can speed up painting
// significantly
Rectangle clipBounds = grp.getClipBounds();
// Paint the table cells
int minCol = clipBounds.x / mColumnWidth;
if (minCol < 0) {
minCol = 0;
}
int maxCol = (clipBounds.x + clipBounds.width) / mColumnWidth;
int columnCount = mModel.getColumnCount();
if (maxCol >= columnCount) {
maxCol = columnCount - 1;
}
// Paint the background
super.paintComponent(grp);
int tableHeight = Math.max(mHeight, clipBounds.y + clipBounds.height);
mBackgroundPainter.paintBackground(grp, mColumnWidth, tableHeight,
minCol, maxCol, clipBounds, mLayout, mModel);
boolean mouseOver = false;
int x = minCol * mColumnWidth;
for (int col = minCol; col <= maxCol; col++) {
int y = mLayout.getColumnStart(col);
int rowCount = mModel.getRowCount(col);
for (int row = 0; row < rowCount; row++) {
// Get the program
ProgramPanel panel = mModel.getProgramPanel(col, row);
// Render the program
if (panel != null) {
int cellHeight = panel.getHeight();
// Check whether the cell is within the clipping area
if (((y + cellHeight) > clipBounds.y)
&& (y < (clipBounds.y + clipBounds.height))) {
Rectangle rec = new Rectangle(x, y, mColumnWidth, cellHeight);
if (Settings.propProgramTableMouseOver.getBoolean()) {
if ((mMouse != null) && (rec.contains(mMouse))) {
mouseOver = true;
} else {
mouseOver = false;
}
}
// calculate clipping intersection between global clip border and current cell rectangle
Shape oldClip = grp.getClip();
rec = rec.intersection((Rectangle)oldClip);
// Paint the cell
if (rec.width > 0 || rec.height > 0) {
grp.setClip(rec);
grp.translate(x, y);