Class MultiLineInput.Builder
- Enclosing class:
MultiLineInput
Builds a
MultiLineInput; from MultiLineInput.builder(String). Also has the options every entry has (Entry.Builder).-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the text box.The text the box starts with; empty by default.A fixed label; seelabel(Supplier).The text above the box, re-read on every refresh.lines(int lines) How many lines the box shows at once, from 2 to 12; 4 by default.maxLength(int maxLength) The most characters the box accepts, line breaks included; 1024 by default.Receives the text after each edit that leaves it valid, on the main thread.Checks the text: returns an error text for invalid input (shown below the box),nullfor valid input.
-
Method Details
-
label
The text above the box, re-read on every refresh. Required.- Parameters:
label- read on refresh- Returns:
- this builder
-
label
A fixed label; seelabel(Supplier).- Parameters:
label- the label- Returns:
- this builder
-
initial
The text the box starts with; empty by default. Line breaks may be"\n","\r\n"or"\r"; cut tomaxLength. Not passed toonChange.- Parameters:
initial- the starting text- Returns:
- this builder
-
maxLength
The most characters the box accepts, line breaks included; 1024 by default. Must be positive.- Parameters:
maxLength- the limit- Returns:
- this builder
-
lines
How many lines the box shows at once, from 2 to 12; 4 by default. Longer text scrolls.- Parameters:
lines- the box's height in lines- Returns:
- this builder
-
validator
Checks the text: returns an error text for invalid input (shown below the box),nullfor valid input. Runs often, on the main thread. By default every text is valid.- Parameters:
validator- maps the text to an error, ornull- Returns:
- this builder
-
onChange
Receives the text after each edit that leaves it valid, on the main thread. Optional.- Parameters:
onChange- receives valid text- Returns:
- this builder
-
build
Builds the text box.- Returns:
- the text box
- Throws:
IllegalStateException- iflabelis missing,maxLengthis not positive orlinesis outside 2 – 12
-