Module com.googlecode.lanterna
Class AWTTerminalImplementation
- java.lang.Object
-
- com.googlecode.lanterna.terminal.swing.GraphicalTerminalImplementation
-
- com.googlecode.lanterna.terminal.swing.AWTTerminalImplementation
-
- All Implemented Interfaces:
InputProvider,IOSafeTerminal,Terminal,java.io.Closeable,java.lang.AutoCloseable
class AWTTerminalImplementation extends GraphicalTerminalImplementation
AWT implementation ofGraphicalTerminalImplementationthat contains all the overrides for AWT Created by martin on 08/02/16.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.googlecode.lanterna.terminal.swing.GraphicalTerminalImplementation
GraphicalTerminalImplementation.TerminalInputListener, GraphicalTerminalImplementation.TerminalMouseListener
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Componentcomponentprivate AWTTerminalFontConfigurationfontConfiguration
-
Constructor Summary
Constructors Constructor Description AWTTerminalImplementation(java.awt.Component component, AWTTerminalFontConfiguration fontConfiguration, TerminalSize initialTerminalSize, TerminalEmulatorDeviceConfiguration deviceConfiguration, TerminalEmulatorColorConfiguration colorConfiguration, TerminalScrollController scrollController)Creates a newAWTTerminalImplementation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AWTTerminalFontConfigurationgetFontConfiguration()protected java.awt.FontgetFontForCharacter(TextCharacter character)Returning the AWT font to use for the specific character.protected intgetFontHeight()Used to find out the font height, in pixelsprotected intgetFontWidth()Used to find out the font width, in pixelsprotected intgetHeight()Used when requiring the total height of the terminal component, in pixelsprotected intgetWidth()Used when requiring the total width of the terminal component, in pixelsprotected booleanisTextAntiAliased()Returnstrueif anti-aliasing is enabled,falseotherwiseKeyStrokereadInput()Returns 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 window-
Methods inherited from class com.googlecode.lanterna.terminal.swing.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 Detail
-
component
private final java.awt.Component component
-
fontConfiguration
private final AWTTerminalFontConfiguration fontConfiguration
-
-
Constructor Detail
-
AWTTerminalImplementation
AWTTerminalImplementation(java.awt.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 Detail
-
getFontConfiguration
public AWTTerminalFontConfiguration 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
protected java.awt.Font getFontForCharacter(TextCharacter character)
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
public KeyStroke 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
-
-