public void render(Graphics g) {
// printCOLS();
if (g == null) return;
Point pos = new Point(5, 15);
Color oldCol = g.getColor();
Color bg = getBackground();
g.setColor(bg);
g.fillRect(0, 0, this.getSize().width, this.getSize().height);
// Now, go through and render them all.
Enumeration e = orderedCells.elements();
while (e.hasMoreElements()) {
CellAddress cell = (CellAddress)e.nextElement();
((Rectangle)cellRects.get(cell)).setLocation(pos.x - 5, pos.y - 15);
g.setColor( pickTextCol(bg) );
// Draw the name of the cell first
String name = stripName(cell.toString());
g.drawString(name, pos.x, pos.y);
pos.y += 5; // jump down 5
// If the agent is being monitored, draw a colored, raised box.
if (monitoredCells.contains(cell)) {
g.setColor((Color)cellColors.get(cell));
g.fill3DRect(pos.x, pos.y, 15, 15, true);
}
else {
g.setColor(unmonitoredCellColor);
g.fill3DRect(pos.x, pos.y, 15, 15, false);
}
// If not, draw a gray sunken one.
pos.x += 25; // Move 10 beyond edge of the rect
pos.y += 12; // Move down 12 pixels from the top edge of the rectangle
g.setColor( pickTextCol(bg) );
if (cellInfo.containsKey(cell)) {
CellListInfo tcli = (CellListInfo)cellInfo.get(cell);
String outString = (tcli.isUp() ? "up" : "down");
g.drawString( outString, pos.x, pos.y );
}
pos.y += 30;
pos.x = 5;
}
g.setColor(oldCol);
}
|