Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
string_box
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Bohn
string_box
Commits
10200b4d
Commit
10200b4d
authored
5 years ago
by
Christopher Bohn
Browse files
Options
Downloads
Patches
Plain Diff
Updated javadoc to show preferred usage
parent
03ccec16
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+16
-16
16 additions, 16 deletions
README.md
with
16 additions
and
16 deletions
README.md
+
16
−
16
View file @
10200b4d
...
...
@@ -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,
`placeString
AlignTopLeft
()`
,
`placeStringAlignTopRight()`
,
`
place
S
tring
AlignBottomLeft()`
, 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 multipl
e
`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-
place
s
tring
string-string-vertical-verticalalignment-int-verticalposition-horizontal-horizontalalignment-int-horizontalposition
)
allow
s
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 th
e
`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.placeString
AlignTopRight
("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.placeString
AlignBottomLeft
("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.placeString
AlignTopLeft("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.placeString
AlignTopLeft
("foo\nbar",
2
, 10)
.placeString
AlignBottomLeft
("larry\ncurly\nmoe",
5
, 6)
.placeString
AlignTopRight
("quux\nxyzzy",
3
, 20)
.placeString
AlignBottomRight
("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);
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment