}
public void draw(Toolkit toolkit) {
/* Get the absolute origin of this component.
*/
Point origin = getLocationOnScreen();
int rows = _model.getRowCount();
int columns = _model.getColumnCount();
int colorpair = getCursesColor();
/* Start by blanking out the table area and drawing the box
* around the table.
*/
toolkit.blankBox(origin, getSize(), colorpair);
toolkit.drawBox(origin, getSize(), colorpair);
/* Now fill in the table headings
*/
int x = 1;
int attr = Toolkit.A_BOLD;
for (int i=0; i<columns; i++) {
toolkit.setCursor(origin.addOffset(x, 0));
toolkit.addChar(' ', attr, colorpair);
toolkit.addString(_model.getColumnName(i), attr, colorpair);
toolkit.addChar(' ', attr, colorpair);
x += getColumnWidth(i) + 1;
}
/* Now draw the vertical lines that divide the columns.
*/
if (_model.getColumnCount() != 0) {
x = getColumnWidth(0) + 1;
for (int i=0; i<columns-1; i++) {
toolkit.setCursor(origin.addOffset(x, 0));
toolkit.addChar(Toolkit.ACS_TTEE, 0, colorpair); // top tee
toolkit.setCursor(origin.addOffset(x, 1));
toolkit.addVerticalLine(rows, 0, colorpair);
toolkit.setCursor(origin.addOffset(x, rows+1));
toolkit.addChar(Toolkit.ACS_BTEE, 0, colorpair); // bottom tee
x += getColumnWidth(i+1) + 1;
}
}
/* Now draw the contents of the cells.
*/
x = 1;
for (int column = 0; column<columns; column++) {
for (int row=0; row<rows; row++) {
toolkit.setCursor(origin.addOffset(x, row+1));
Object value = _model.getValueAt(row, column);
/* Show the currently SELECTED rows and columns in reverse video
*/
int attrib =