Skip to content
Snippets Groups Projects
Commit 10200b4d authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

Updated javadoc to show preferred usage

parent 03ccec16
Branches
No related tags found
No related merge requests found
...@@ -10,13 +10,13 @@ for the last line and will place the cursor at the start of the last line for us ...@@ -10,13 +10,13 @@ for the last line and will place the cursor at the start of the last line for us
24x80 StringBox with the two-argument constructor and print it with `System.out.print()`, which will fill a standard 24x80 StringBox with the two-argument constructor and print it with `System.out.print()`, which will fill a standard
24x80 window entirely and place the cursor at the end of the last line for user input. 24x80 window entirely and place the cursor at the end of the last line for user input.
A StringBox is populated with repeated calls to `placeString()` and its related methods, `placeStringAlignTopLeft()`, A StringBox is populated with repeated calls to `placeString()`. The [5-argument `placeString()`
`placeStringAlignTopRight()`, `placeStringAlignBottomLeft()`, and `placeStringAlignBottomRight()`. The four latter method](#public-stringbox-placestringstring-string-vertical-verticalalignment-int-verticalposition-horizontal-horizontalalignment-int-horizontalposition)
methods allow you to specify the top/bottom alignment and left/right justification. Since we expect that anchoring allows you to specify the top/bottom alignment and left/right justification. Since we expect that anchoring a string
a string with its upper-left corner to be the common case, the shorter-named method `placeString()` defaults to with its upper-left corner to be the common case, the [3-argument `placeString()`
that behavior. Each of the `placeString*()` methods returns its StringBox object, which allows multiple `placeString*()` method](#public-stringboxint-boxheight-int-boxwidth) defaults to that behavior. Each of the `placeString()` methods
calls to be chained. After you have constructed the screen to be displayed, a call to `toString()` will produce a string returns its StringBox object, which allows multiple `placeString()` calls to be chained. After you have constructed the
suitable for printing. screen to be displayed, a call to `toString()` will produce a string suitable for printing.
You may pass multi-line strings to the `placeString*()` methods, and the result would be the equivalent of making You may pass multi-line strings to the `placeString*()` methods, and the result would be the equivalent of making
several `placeString*()` calls with one-line strings with the same left/right alignment column and adjacent rows. several `placeString*()` calls with one-line strings with the same left/right alignment column and adjacent rows.
...@@ -88,7 +88,7 @@ as they both produce ...@@ -88,7 +88,7 @@ as they both produce
Inserted strings can be right-justified instead of left-justified: Inserted strings can be right-justified instead of left-justified:
``` ```
stringBox.placeStringAlignTopRight("foo\nbar baz",2,10); stringBox.placeString("foo\nbar baz",Vertical.TOP,2,Horizontal.RIGHT,10);
``` ```
produces produces
...@@ -115,7 +115,7 @@ produces ...@@ -115,7 +115,7 @@ produces
You can specify the bottom row for an inserted string instead of its top row: You can specify the bottom row for an inserted string instead of its top row:
``` ```
stringBox.placeStringAlignBottomLeft("foo\nbar baz",2,10); stringBox.placeString("foo\nbar baz",Vertical.BOTTOM,2,Horizontal.LEFT,10);
``` ```
produces produces
...@@ -143,15 +143,15 @@ produces ...@@ -143,15 +143,15 @@ produces
Many emojis occupy more than one horizontal space; however, this is not a problem for StringBox because those emojis Many emojis occupy more than one horizontal space; however, this is not a problem for StringBox because those emojis
are also actually multiple characters: are also actually multiple characters:
``` ```
stringBox.placeStringAlignTopLeft("foo\n_😄_",2,10); stringBox.placeString("foo\n_😄_",Vertical.TOP,2,Horizontal.LEFT,10);
``` ```
which is equivalent to which is equivalent to
``` ```
stringBox.placeStringAlignTopLeft("foo\n_\uD83D\uDE04_",2,10); stringBox.placeStringAlignTopLeft("foo\n_\uD83D\uDE04_",Vertical.TOP,2,Horizontal.LEFT,10);
``` ```
or, using the [com.vdurmont.emoji-java](https://github.com/vdurmont/emoji-java) library: or, using the [com.vdurmont.emoji-java](https://github.com/vdurmont/emoji-java) library:
``` ```
stringBox.placeStringAlignTopLeft(EmojiParser.parseToUnicode("foo\n_:smile:_"),2,10); stringBox.placeStringAlignTopLeft(EmojiParser.parseToUnicode("foo\n_:smile:_"),Vertical.TOP,2,Horizontal.RIGHT,10);
``` ```
produces produces
...@@ -205,10 +205,10 @@ stringBox.placeString("foo\nbar baz",-1,-1); ...@@ -205,10 +205,10 @@ stringBox.placeString("foo\nbar baz",-1,-1);
If two inserted strings overlap, the string inserted last will overwrite a portion of the string written first: If two inserted strings overlap, the string inserted last will overwrite a portion of the string written first:
``` ```
stringBox.placeStringAlignTopLeft("foo\nbar", 2, 10) stringBox.placeString("foo\nbar", Vertical.TOP, 2, Horizontal.LEFT, 10)
.placeStringAlignBottomLeft("larry\ncurly\nmoe", 5, 6) .placeString("larry\ncurly\nmoe", Vertical.BOTTOM, 5, Horizontal.LEFT, 6)
.placeStringAlignTopRight("quux\nxyzzy", 3, 20) .placeString("quux\nxyzzy", Vertical.TOP, 3, Horizontal.RIGHT, 20)
.placeStringAlignBottomRight("one\ntwo\nthree", 10, 15); .placeString("one\ntwo\nthree", Vertical.BOTTOM, 10, Horizontal.RIGHT, 15);
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment