A simple paragraph

This example shows how to create a paragraph, add text, and render the paragraph. It also demonstrates that all excessive white spaces (extra blanks, tabulators, new lines) will be removed automatically. Furthermore, the paragraph will break lines automatically to the set width (in the example the default width of 80 characters). This automatic line break uses words (not characters).

1
2
3
4
5
6
7
AsciiParagraph ap = new AsciiParagraph();
ap.addText("line        1");
ap.addText("2  2");
ap.addText("more text with        tab and \n newline");
ap.addText("some more text to get it over the 80 character default width");
String rend = ap.render();
System.out.println(rend);

The resulting output:

line 1 2 2 more text with tab and newline some more text to get it over  the  80
character default width