Graphics
The TermGraphics
class offers a variety of methods for fill a cell buffer.
Create graphics type by buffer:
final TermDim winSize = terminal.windowSize(); TermGraphics termGraphics = TermGraphics.create(winSize);Execute some graphic fill methods:
termGraphics.foregroundColor(TerminalColor.GREEN); termGraphics.fillRect(2, 2, 5, 5, '#');Display graphics buffer to terminal screen:
ScreenRenderer fastScreenRenderer = new FastScreenRenderer(terminal); fastScreenRenderer.render(termGraphics.buffer(), new TerminalState());
Console:

BoxShape
A box shape is a visual way to show frame symbols
Frame symbol types: NORMAL
, BRIGHT
, DOUBLE
BoxShape boxShape = new BoxShape(new TermDim(16, 16));
boxShape.addBox(1, 1, 16, 16, Type.DOUBLE); //x1, y1, x2, y2, type
boxShape.addVertical(8, 1, 16, Type.NORMAL); //x1, y1, y2, type
boxShape.addHorizontal(1, 8, 16, Type.NORMAL); //x1, y1, x2, type
boxShape.addHorizontal(1, 4, 16, Type.BRIGHT); //x1, y1, x2, type
boxShape.addVertical(12, 8, 16, Type.DOUBLE); //x1, y1, y2, type
termGraphics.drawShape(1, 1, boxShape);

addVertical(x1,y1,y2,type)
addHorizontal(x1,y1,x2,type)
addBox(x1,y1,x2,y2,type)
Last modified: 01 Juni 2025