/**
* Use an outlined block for the cursor.
*/
- OUTLINE
+ OUTLINE,
+
+ /**
+ * Use a vertical bar for the cursor.
+ */
+ VERTICAL_BAR,
}
// ------------------------------------------------------------------------
/**
* Width of a character cell in pixels.
*/
- private int textWidth = 1;
+ private int textWidth = 16;
/**
* Height of a character cell in pixels.
*/
- private int textHeight = 1;
+ private int textHeight = 20;
/**
* Width of a character cell in pixels, as reported by font.
cursorStyle = CursorStyle.OUTLINE;
} else if (cursorStyleString.equals("block")) {
cursorStyle = CursorStyle.BLOCK;
+ } else if (cursorStyleString.equals("verticalbar")) {
+ cursorStyle = CursorStyle.VERTICAL_BAR;
}
// Pull the system property for triple buffering.
/*
System.err.println("drawGlyph(): " + xPixel + " " + yPixel +
" " + cell);
- */
+ */
BufferedImage image = null;
if (cell.isBlink() && !cursorBlinkVisible) {
|| (cell.isBlink() && cursorBlinkVisible)
) {
gr2.setColor(attrToForegroundColor(cellColor));
- char [] chars = new char[1];
- chars[0] = cell.getChar();
- gr2.drawChars(chars, 0, 1, gr2x + textAdjustX,
+ char [] chars = Character.toChars(cell.getChar());
+ gr2.drawChars(chars, 0, chars.length, gr2x + textAdjustX,
gr2y + textHeight - maxDescent + textAdjustY);
if (cell.isUnderline()) {
case OUTLINE:
gr.drawRect(xPixel, yPixel, cursorWidth - 1, textHeight - 1);
break;
+ case VERTICAL_BAR:
+ gr.fillRect(xPixel, yPixel, 2, textHeight);
+ break;
}
}
}
if (bounds != null) {
// Only update what is in the bounds
xCellMin = textColumn(bounds.x);
- xCellMax = textColumn(bounds.x + bounds.width);
+ xCellMax = textColumn(bounds.x + bounds.width) + 1;
if (xCellMax > width) {
xCellMax = width;
}
xCellMin = 0;
}
yCellMin = textRow(bounds.y);
- yCellMax = textRow(bounds.y + bounds.height);
+ yCellMax = textRow(bounds.y + bounds.height) + 1;
if (yCellMax > height) {
yCellMax = height;
}
/*
System.err.printf("bounds %s X %d %d Y %d %d\n",
bounds, xCellMin, xCellMax, yCellMin, yCellMax);
- */
+ */
for (int y = yCellMin; y < yCellMax; y++) {
for (int x = xCellMin; x < xCellMax; x++) {
break;
default:
if (!alt && ctrl && !shift) {
+ // Control character, replace ch with 'A', 'B', etc.
ch = KeyEvent.getKeyText(key.getKeyCode()).charAt(0);
}
// Not a special key, put it together