Class LiveRegion
java.lang.Object
com.codename1.cli.LiveRegion
- All Implemented Interfaces:
AutoCloseable
The last few lines of the terminal, redrawn in place: what progress bars, spinners and prompts are drawn on.
update(String...) replaces the lines; println(String) prints a line above them, so log
output and a live display can be mixed without tearing. Each frame goes out
in one write. Lines are cut to the terminal's width, because a line that
wrapped would throw off the count of lines to move back over.
When standard output is not a terminal nothing is redrawn: println(String)
prints its line and close() prints the final lines once, so a log gets the
outcome without a frame per update.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Erases the region from the screen, leaving the cursor where it began.voidclose()Leaves the last lines on screen, moves below them and shows the cursor.booleanisLive()Whether this region redraws in place.voidPrintstextabove the region and redraws the region under it.voidReplaces the lines and redraws them, with the cursor hidden.
-
Constructor Details
-
LiveRegion
public LiveRegion()A region on standard output, live when it is a terminal.
-
-
Method Details
-
isLive
public boolean isLive()Whether this region redraws in place. -
update
Replaces the lines and redraws them, with the cursor hidden. -
println
Printstextabove the region and redraws the region under it. -
clear
public void clear()Erases the region from the screen, leaving the cursor where it began. -
close
public void close()Leaves the last lines on screen, moves below them and shows the cursor. Off a terminal, prints the last lines.- Specified by:
closein interfaceAutoCloseable
-