public interface Terminal extends InputProvider
Modifier and Type | Interface and Description |
---|---|
static class |
Terminal.Color |
static interface |
Terminal.ResizeListener
Listener interface that can be used to be alerted on terminal resizing
|
static class |
Terminal.SGR
SGR - Select Graphic Rendition, changes the state of the terminal as to
what kind of text to print after this command.
|
Modifier and Type | Method and Description |
---|---|
void |
addResizeListener(Terminal.ResizeListener listener)
Adds a
ResizeListener to be called when the terminal has changed
size. |
void |
applyBackgroundColor(int index)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyBackgroundColor(int r,
int g,
int b)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyBackgroundColor(Terminal.Color color)
Changes the background color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(int index)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(int r,
int g,
int b)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applyForegroundColor(Terminal.Color color)
Changes the foreground color for all the following characters put to the
terminal.
|
void |
applySGR(Terminal.SGR... options)
Activates an
SGR code for all the following characters put to the
terminal. |
void |
clearScreen()
Removes all the characters, colors and graphics from the screep and leaves
you with a big empty space.
|
void |
enterPrivateMode()
Calling this method will, where supported, give your terminal a private
area to use, separate from what was there before.
|
void |
exitPrivateMode()
If you have previously entered private mode, this method will exit this
and, depending on implementation, maybe restore what the terminal looked
like before private mode was entered.
|
void |
flush()
Calls
flush() on the underlying OutputStream object, or
whatever other implementation this terminal is built around. |
TerminalSize |
getTerminalSize()
Returns the size of the terminal, expressed as a
TerminalSize
object. |
void |
moveCursor(int x,
int y)
Moves the text cursor to a new location
|
void |
putCharacter(char c)
Prints one character to the terminal at the current cursor location.
|
TerminalSize |
queryTerminalSize()
Deprecated.
Being deprecated since 2.0.1 in favor of getTerminalSize()
|
void |
removeResizeListener(Terminal.ResizeListener listener)
Removes a
ResizeListener from the list of listeners to be notified
when the terminal has changed size |
void |
setCursorVisible(boolean visible)
Hides or shows the text cursor
|
addInputProfile, readInput
void enterPrivateMode()
LanternaException
void exitPrivateMode()
LanternaException
void clearScreen()
moveCursor
next.LanternaException
void moveCursor(int x, int y)
x
- The 0-indexed column to place the cursor aty
- The 0-indexed row to place the cursor atLanternaException
void setCursorVisible(boolean visible)
visible
- Hides the text cursor if false
and shows it if true
void putCharacter(char c)
c
- LanternaException
void applySGR(Terminal.SGR... options)
SGR
code for all the following characters put to the
terminal.options
- List of SGR codesLanternaException
Terminal.SGR
void applyForegroundColor(Terminal.Color color)
color
- Color to use for foregroundLanternaException
void applyForegroundColor(int r, int g, int b)
r
- Red intensity, from 0 to 255g
- Green intensity, from 0 to 255b
- Blue intensity, from 0 to 255void applyForegroundColor(int index)
For more details on this, please see this commit message to Konsole.
index
- Color index from the XTerm 256 color spacevoid applyBackgroundColor(Terminal.Color color)
color
- Color to use for the backgroundLanternaException
void applyBackgroundColor(int r, int g, int b)
r
- Red intensity, from 0 to 255g
- Green intensity, from 0 to 255b
- Blue intensity, from 0 to 255void applyBackgroundColor(int index)
For more details on this, please see this commit message to Konsole.
index
- Index of the color to use, from the XTerm 256 color extensionvoid addResizeListener(Terminal.ResizeListener listener)
ResizeListener
to be called when the terminal has changed
size.listener
- Listener object to be called when the terminal has been changedTerminal.ResizeListener
void removeResizeListener(Terminal.ResizeListener listener)
ResizeListener
from the list of listeners to be notified
when the terminal has changed sizelistener
- Listener object to removeTerminal.ResizeListener
@Deprecated TerminalSize queryTerminalSize()
TerminalSize
object. Please note that the default way of figuring
this information out is asynchorous and so you will be given the last
known dimensions. With proper resize listeners set up, this will only be
a problem for figuring out the initial size of the terminal.TerminalSize
object representing the size of the terminalLanternaException
TerminalSize
TerminalSize getTerminalSize()
TerminalSize
object. Please bear in mind that depending on the Terminal
implementation, this may or may not be accurate. See the implementing
classes for more information.void flush()
flush()
on the underlying OutputStream
object, or
whatever other implementation this terminal is built around.LanternaException
Copyright © 2015. All Rights Reserved.