Class AbstractTerminal
java.lang.Object
com.googlecode.lanterna.terminal.AbstractTerminal
- All Implemented Interfaces:
InputProvider, Terminal, Closeable, AutoCloseable
- Direct Known Subclasses:
DefaultVirtualTerminal, StreamBasedTerminal
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResizeListener(TerminalResizeListener listener) Adds aTerminalResizeListenerto be called when the terminal has changed size.Creates a new TextGraphics object that uses this Terminal directly when outputting.protected voidonResized(int columns, int rows) Call this method when the terminal has been resized or the initial size of the terminal has been discovered.protected voidonResized(TerminalSize newSize) Call this method when the terminal has been resized or the initial size of the terminal has been discovered.voidremoveResizeListener(TerminalResizeListener listener) Removes aTerminalResizeListenerfrom the list of listeners to be notified when the terminal has changed sizeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface InputProvider
pollInput, readInputMethods inherited from interface Terminal
bell, clearScreen, close, disableSGR, enableSGR, enquireTerminal, enterPrivateMode, exitPrivateMode, flush, getCursorPosition, getTerminalSize, putCharacter, putString, resetColorAndSGR, setBackgroundColor, setCursorPosition, setCursorPosition, setCursorVisible, setForegroundColor
-
Field Details
-
resizeListeners
-
lastKnownSize
-
-
Constructor Details
-
AbstractTerminal
protected AbstractTerminal()
-
-
Method Details
-
addResizeListener
Description copied from interface:TerminalAdds aTerminalResizeListenerto be called when the terminal has changed size. There is no guarantee that this listener will really be invoked when the terminal has changed size, at all depends on the terminal emulator implementation. Normally on Unix systems the WINCH signal will be sent to the process and lanterna can intercept this.There are no guarantees on what thread the call will be made on, so please be careful with what kind of operation you perform in this callback. You should probably not take too long to return.
- Specified by:
addResizeListenerin interfaceTerminal- Parameters:
listener- Listener object to be called when the terminal has been changed- See Also:
-
removeResizeListener
Description copied from interface:TerminalRemoves aTerminalResizeListenerfrom the list of listeners to be notified when the terminal has changed size- Specified by:
removeResizeListenerin interfaceTerminal- Parameters:
listener- Listener object to remove- See Also:
-
onResized
protected void onResized(int columns, int rows) Call this method when the terminal has been resized or the initial size of the terminal has been discovered. It will trigger all resize listeners, but only if the size has changed from before.- Parameters:
columns- Number of columns in the new sizerows- Number of rows in the new size
-
onResized
Call this method when the terminal has been resized or the initial size of the terminal has been discovered. It will trigger all resize listeners, but only if the size has changed from before.- Parameters:
newSize- Last discovered terminal size
-
newTextGraphics
Description copied from interface:TerminalCreates a new TextGraphics object that uses this Terminal directly when outputting. Keep in mind that you are probably better off to switch to a Screen to make advanced text graphics more efficient. Also, this TextGraphics implementation will not call.flush()after any operation, so you'll need to do that on your own.- Specified by:
newTextGraphicsin interfaceTerminal- Returns:
- TextGraphics implementation that draws directly using this Terminal interface
- Throws:
IOException- If there was an I/O error when setting up theTextGraphicsobject
-