0

I'm using JLine for a console application and I would like to emit text with a strike-through effect.

Is this possible with JLine and how would I do it?

Are there any platform-specific concerns?

soc
  • 27,983
  • 20
  • 111
  • 215

1 Answers1

1

Provided your terminal supports it this is how you would do it:

ANSIBuffer buffer = new ANSIBuffer();
buffer.attrib("Text", 9);
System.out.println(buffer.getAnsiBuffer());

You can also use Jansi:

Ansi ansi = new Ansi();
ansi.a(Ansi.Attribute.STRIKETHROUGH_ON);
ansi.a("Striked");
ansi.reset();
System.out.println(ansi);
Emmanuel Bourg
  • 9,601
  • 3
  • 48
  • 76