diff --git a/README.md b/README.md index efd72b87c00a42656e332a719e0749dc6eb61aa7..f5df01b1c6da25ada0b22e5d73a9a01d2c8b46fe 100644 --- a/README.md +++ b/README.md @@ -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 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()`, -`placeStringAlignTopRight()`, `placeStringAlignBottomLeft()`, and `placeStringAlignBottomRight()`. The four latter -methods allow you to specify the top/bottom alignment and left/right justification. Since we expect that anchoring -a string with its upper-left corner to be the common case, the shorter-named method `placeString()` defaults to -that behavior. Each of the `placeString*()` methods returns its StringBox object, which allows multiple `placeString*()` -calls to be chained. After you have constructed the screen to be displayed, a call to `toString()` will produce a string -suitable for printing. +A StringBox is populated with repeated calls to `placeString()`. The [5-argument `placeString()` +method](#public-stringbox-placestringstring-string-vertical-verticalalignment-int-verticalposition-horizontal-horizontalalignment-int-horizontalposition) +allows you to specify the top/bottom alignment and left/right justification. Since we expect that anchoring a string +with its upper-left corner to be the common case, the [3-argument `placeString()` +method](#public-stringboxint-boxheight-int-boxwidth) defaults to that behavior. Each of the `placeString()` methods +returns its StringBox object, which allows multiple `placeString()` calls to be chained. After you have constructed the +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 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 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 @@ -115,7 +115,7 @@ produces 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 @@ -143,15 +143,15 @@ produces Many emojis occupy more than one horizontal space; however, this is not a problem for StringBox because those emojis 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 ``` -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: ``` -stringBox.placeStringAlignTopLeft(EmojiParser.parseToUnicode("foo\n_:smile:_"),2,10); +stringBox.placeStringAlignTopLeft(EmojiParser.parseToUnicode("foo\n_:smile:_"),Vertical.TOP,2,Horizontal.RIGHT,10); ``` produces @@ -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: ``` -stringBox.placeStringAlignTopLeft("foo\nbar", 2, 10) - .placeStringAlignBottomLeft("larry\ncurly\nmoe", 5, 6) - .placeStringAlignTopRight("quux\nxyzzy", 3, 20) - .placeStringAlignBottomRight("one\ntwo\nthree", 10, 15); +stringBox.placeString("foo\nbar", Vertical.TOP, 2, Horizontal.LEFT, 10) + .placeString("larry\ncurly\nmoe", Vertical.BOTTOM, 5, Horizontal.LEFT, 6) + .placeString("quux\nxyzzy", Vertical.TOP, 3, Horizontal.RIGHT, 20) + .placeString("one\ntwo\nthree", Vertical.BOTTOM, 10, Horizontal.RIGHT, 15); ```