Class AWTTerminalImplementation
java.lang.Object
com.googlecode.lanterna.terminal.swing.GraphicalTerminalImplementation
com.googlecode.lanterna.terminal.swing.AWTTerminalImplementation
- All Implemented Interfaces:
InputProvider, IOSafeTerminal, Terminal, Closeable, AutoCloseable
AWT implementation of
GraphicalTerminalImplementation that contains all the overrides for AWT
Created by martin on 08/02/16.-
Nested Class Summary
Nested classes/interfaces inherited from class GraphicalTerminalImplementation
GraphicalTerminalImplementation.TerminalInputListener, GraphicalTerminalImplementation.TerminalMouseListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Componentprivate final AWTTerminalFontConfiguration -
Constructor Summary
ConstructorsConstructorDescriptionAWTTerminalImplementation(Component component, AWTTerminalFontConfiguration fontConfiguration, TerminalSize initialTerminalSize, TerminalEmulatorDeviceConfiguration deviceConfiguration, TerminalEmulatorColorConfiguration colorConfiguration, TerminalScrollController scrollController) Creates a newAWTTerminalImplementation -
Method Summary
Modifier and TypeMethodDescriptionprotected FontgetFontForCharacter(TextCharacter character) Returning the AWT font to use for the specific character.protected intUsed to find out the font height, in pixelsprotected intUsed to find out the font width, in pixelsprotected intUsed when requiring the total height of the terminal component, in pixelsprotected intgetWidth()Used when requiring the total width of the terminal component, in pixelsprotected booleanReturnstrueif anti-aliasing is enabled,falseotherwiseReturns the nextKeyoff the input queue or blocks until one is available.protected voidrepaint()Called by theGraphicalTerminalImplementationwhen it would like the OS to schedule a repaint of the windowMethods inherited from class GraphicalTerminalImplementation
addInput, addResizeListener, bell, clearScreen, close, disableSGR, enableSGR, enquireTerminal, enterPrivateMode, exitPrivateMode, flush, getColorConfiguration, getCursorPosition, getDeviceConfiguration, getPreferredSize, getTerminalSize, newTextGraphics, onCreated, onDestroyed, paintComponent, pollInput, putCharacter, putString, removeResizeListener, resetColorAndSGR, setBackgroundColor, setCursorPosition, setCursorPosition, setCursorVisible, setForegroundColor, startBlinkTimer, stopBlinkTimer
-
Field Details
-
component
-
fontConfiguration
-
-
Constructor Details
-
AWTTerminalImplementation
AWTTerminalImplementation(Component component, AWTTerminalFontConfiguration fontConfiguration, TerminalSize initialTerminalSize, TerminalEmulatorDeviceConfiguration deviceConfiguration, TerminalEmulatorColorConfiguration colorConfiguration, TerminalScrollController scrollController) Creates a newAWTTerminalImplementation- Parameters:
component- Component that is the AWT terminal surfacefontConfiguration- Font configuration to useinitialTerminalSize- Initial size of the terminaldeviceConfiguration- Device configurationcolorConfiguration- Color configurationscrollController- Controller to be used when inspecting scroll status
-
-
Method Details
-
getFontConfiguration
-
getFontHeight
protected int getFontHeight()Description copied from class:GraphicalTerminalImplementationUsed to find out the font height, in pixels- Specified by:
getFontHeightin classGraphicalTerminalImplementation- Returns:
- Terminal font height in pixels
-
getFontWidth
protected int getFontWidth()Description copied from class:GraphicalTerminalImplementationUsed to find out the font width, in pixels- Specified by:
getFontWidthin classGraphicalTerminalImplementation- Returns:
- Terminal font width in pixels
-
getHeight
protected int getHeight()Description copied from class:GraphicalTerminalImplementationUsed when requiring the total height of the terminal component, in pixels- Specified by:
getHeightin classGraphicalTerminalImplementation- Returns:
- Height of the terminal component, in pixels
-
getWidth
protected int getWidth()Description copied from class:GraphicalTerminalImplementationUsed when requiring the total width of the terminal component, in pixels- Specified by:
getWidthin classGraphicalTerminalImplementation- Returns:
- Width of the terminal component, in pixels
-
getFontForCharacter
Description copied from class:GraphicalTerminalImplementationReturning the AWT font to use for the specific character. This might not always be the same, in case a we are trying to draw an unusual character (probably CJK) which isn't contained in the standard terminal font.- Specified by:
getFontForCharacterin classGraphicalTerminalImplementation- Parameters:
character- Character to get the font for- Returns:
- Font to be used for this character
-
isTextAntiAliased
protected boolean isTextAntiAliased()Description copied from class:GraphicalTerminalImplementationReturnstrueif anti-aliasing is enabled,falseotherwise- Specified by:
isTextAntiAliasedin classGraphicalTerminalImplementation- Returns:
trueif anti-aliasing is enabled,falseotherwise
-
repaint
protected void repaint()Description copied from class:GraphicalTerminalImplementationCalled by theGraphicalTerminalImplementationwhen it would like the OS to schedule a repaint of the window- Specified by:
repaintin classGraphicalTerminalImplementation
-
readInput
Description copied from interface:InputProviderReturns the nextKeyoff the input queue or blocks until one is available. NOTE: In previous versions of Lanterna, this method was not blocking. From lanterna 3, it is blocking and you can callpollInput()for the non-blocking version.- Specified by:
readInputin interfaceInputProvider- Specified by:
readInputin interfaceIOSafeTerminal- Overrides:
readInputin classGraphicalTerminalImplementation- Returns:
- Key object which represents a keystroke coming in through the input stream
-