1193 |
TableCellRenderer rend, TableModel data, |
TableCellRenderer rend, TableModel data, |
1194 |
int rowLead, int colLead) |
int rowLead, int colLead) |
1195 |
{ |
{ |
1196 |
boolean rowSelAllowed = table.getRowSelectionAllowed(); |
Component comp = table.prepareRenderer(rend, row, col); |
|
boolean colSelAllowed = table.getColumnSelectionAllowed(); |
|
|
boolean isSel = false; |
|
|
if (rowSelAllowed && colSelAllowed || !rowSelAllowed && !colSelAllowed) |
|
|
isSel = table.isCellSelected(row, col); |
|
|
else |
|
|
isSel = table.isRowSelected(row) && table.getRowSelectionAllowed() |
|
|
|| table.isColumnSelected(col) && table.getColumnSelectionAllowed(); |
|
|
|
|
|
// Determine the focused cell. The focused cell is the cell at the |
|
|
// leadSelectionIndices of the row and column selection model. |
|
|
ListSelectionModel rowSel = table.getSelectionModel(); |
|
|
ListSelectionModel colSel = table.getColumnModel().getSelectionModel(); |
|
|
boolean hasFocus = table.hasFocus() && table.isEnabled() |
|
|
&& rowSel.getLeadSelectionIndex() == row |
|
|
&& colSel.getLeadSelectionIndex() == col; |
|
|
|
|
|
Component comp = rend.getTableCellRendererComponent(table, |
|
|
data.getValueAt(row, col), |
|
|
isSel, hasFocus, row, col); |
|
|
|
|
1197 |
rendererPane.paintComponent(g, comp, table, bounds); |
rendererPane.paintComponent(g, comp, table, bounds); |
1198 |
|
|
1199 |
// FIXME: this is manual painting of the Caret, why doesn't the |
// FIXME: this is manual painting of the Caret, why doesn't the |
1200 |
// JTextField take care of this itself? |
// JTextField take care of this itself? |
1201 |
if (comp instanceof JTextField) |
if (comp instanceof JTextField) |
1243 |
width - gap.width + 1, |
width - gap.width + 1, |
1244 |
height - gap.height); |
height - gap.height); |
1245 |
if (bounds.intersects(clip)) |
if (bounds.intersects(clip)) |
1246 |
{ |
{ |
1247 |
paintCell(gfx, r, c, bounds, table.getCellRenderer(r, c), |
paintCell(gfx, r, c, bounds, table.getCellRenderer(r, c), |
1248 |
table.getModel(), |
table.getModel(), |
1249 |
table.getSelectionModel().getLeadSelectionIndex(), |
table.getSelectionModel().getLeadSelectionIndex(), |
1266 |
x = x0; |
x = x0; |
1267 |
Color save = gfx.getColor(); |
Color save = gfx.getColor(); |
1268 |
gfx.setColor(grid); |
gfx.setColor(grid); |
|
boolean paintedLine = false; |
|
1269 |
for (int c = 0; c < ncols && x < xmax; ++c) |
for (int c = 0; c < ncols && x < xmax; ++c) |
1270 |
{ |
{ |
1271 |
x += cols.getColumn(c).getWidth(); |
x += cols.getColumn(c).getWidth(); |
1272 |
gfx.drawLine(x, y0, x, ymax); |
gfx.drawLine(x, y0, x, ymax); |
|
paintedLine = true; |
|
1273 |
} |
} |
1274 |
gfx.setColor(save); |
gfx.setColor(save); |
1275 |
} |
} |
1280 |
y = y0; |
y = y0; |
1281 |
Color save = gfx.getColor(); |
Color save = gfx.getColor(); |
1282 |
gfx.setColor(grid); |
gfx.setColor(grid); |
|
boolean paintedLine = false; |
|
1283 |
for (int r = 0; r < nrows && y < ymax; ++r) |
for (int r = 0; r < nrows && y < ymax; ++r) |
1284 |
{ |
{ |
1285 |
y += height; |
y += height; |
1286 |
gfx.drawLine(x0, y, xmax, y); |
gfx.drawLine(x0, y, xmax, y); |
|
paintedLine = true; |
|
1287 |
} |
} |
1288 |
gfx.setColor(save); |
gfx.setColor(save); |
1289 |
} |
} |