- public void paint(Graphics gr) {
-
- for (int y = 0; y < screen.height; y++) {
- for (int x = 0; x < screen.width; x++) {
- Cell lCell = screen.logical[x][y];
- Cell pCell = screen.physical[x][y];
-
- int xPixel = x * (textWidth + 1) + left;
- int yPixel = y * (textHeight + 1) + top - y;
-
- if (!lCell.equals(pCell)) {
- // Draw the background rectangle, then the foreground
- // character.
- if (lCell.getBackColor().equals(jexer.bits.Color.BLACK)) {
- gr.setColor(Color.black);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.RED)) {
- gr.setColor(Color.red);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.BLUE)) {
- gr.setColor(Color.blue);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.GREEN)) {
- gr.setColor(Color.green);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.YELLOW)) {
- gr.setColor(Color.yellow);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.CYAN)) {
- gr.setColor(Color.cyan);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.MAGENTA)) {
- gr.setColor(Color.magenta);
- } else if (lCell.getBackColor().equals(jexer.bits.Color.WHITE)) {
- gr.setColor(Color.white);
- }
- gr.fillRect(xPixel, yPixel, textWidth + 1,
- textHeight + 2);
-
- if (lCell.getForeColor().equals(jexer.bits.Color.BLACK)) {
- gr.setColor(Color.black);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.RED)) {
- gr.setColor(Color.red);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.BLUE)) {
- gr.setColor(Color.blue);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.GREEN)) {
- gr.setColor(Color.green);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.YELLOW)) {
- gr.setColor(Color.yellow);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.CYAN)) {
- gr.setColor(Color.cyan);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.MAGENTA)) {
- gr.setColor(Color.magenta);
- } else if (lCell.getForeColor().equals(jexer.bits.Color.WHITE)) {
- gr.setColor(Color.white);
- }
- char [] chars = new char[1];
- chars[0] = lCell.getChar();
- gr.drawChars(chars, 0, 1, xPixel,
- yPixel + textHeight - 2);