public void drawCursor(char c, Graphics2D gfx, TextStyle style) { TerminalCursorState state = computeCursorState(); // hidden: do nothing if (state == TerminalCursorState.HIDDEN) { return; } else { final int x = getCoordX(); final int y = getCoordY(); if (y >= 0 && y < myTermSize.height) { if (state == TerminalCursorState.SHOWING) { TextStyle styleToDraw = getInversedStyle(style); drawCharacters(x, y, styleToDraw, new CharBuffer(c, 1), gfx); } else if (state == TerminalCursorState.NO_FOCUS) { int xCoord = x * myCharSize.width; int yCoord = y * myCharSize.height; gfx.setColor( getPalette().getColor(myStyleState.getForeground(style.getForegroundForRun()))); gfx.drawRect(xCoord, yCoord, myCharSize.width - 1, myCharSize.height - 1); } } } }