public void paintCursor(Graphics g) {
        if (cursorState && hasFocus()) {
            switch (cursorType) {
                case CURSOR_OVERSTRIKE:
                case CURSOR_INSERT: 
                    int x = cursorX * getCharWidth();
                    int y = cursorY * getCharHeight();
                    g.setColor(getCursorColor());
                    g.setXORMode(defaultAttributes.getBackground());
                    g.drawLine(x, y, x, y + getCharHeight() - 1);
                    break;
                case CURSOR_INVISIBLE: break;
                default: //assert false : "cursorType is invalid";
            }
        }
    }