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 ofGraphicalTerminalImplementation
that 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.Component
component
private AWTTerminalFontConfiguration
fontConfiguration
-
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 AWTTerminalFontConfiguration
getFontConfiguration()
protected java.awt.Font
getFontForCharacter(TextCharacter character)
Returning the AWT font to use for the specific character.protected int
getFontHeight()
Used to find out the font height, in pixelsprotected int
getFontWidth()
Used to find out the font width, in pixelsprotected int
getHeight()
Used when requiring the total height of the terminal component, in pixelsprotected int
getWidth()
Used when requiring the total width of the terminal component, in pixelsprotected boolean
isTextAntiAliased()
Returnstrue
if anti-aliasing is enabled,false
otherwiseKeyStroke
readInput()
Returns the nextKey
off the input queue or blocks until one is available.protected void
repaint()
Called by theGraphicalTerminalImplementation
when 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:GraphicalTerminalImplementation
Used to find out the font height, in pixels- Specified by:
getFontHeight
in classGraphicalTerminalImplementation
- Returns:
- Terminal font height in pixels
-
getFontWidth
protected int getFontWidth()
Description copied from class:GraphicalTerminalImplementation
Used to find out the font width, in pixels- Specified by:
getFontWidth
in classGraphicalTerminalImplementation
- Returns:
- Terminal font width in pixels
-
getHeight
protected int getHeight()
Description copied from class:GraphicalTerminalImplementation
Used when requiring the total height of the terminal component, in pixels- Specified by:
getHeight
in classGraphicalTerminalImplementation
- Returns:
- Height of the terminal component, in pixels
-
getWidth
protected int getWidth()
Description copied from class:GraphicalTerminalImplementation
Used when requiring the total width of the terminal component, in pixels- Specified by:
getWidth
in classGraphicalTerminalImplementation
- Returns:
- Width of the terminal component, in pixels
-
getFontForCharacter
protected java.awt.Font getFontForCharacter(TextCharacter character)
Description copied from class:GraphicalTerminalImplementation
Returning 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:
getFontForCharacter
in 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:GraphicalTerminalImplementation
Returnstrue
if anti-aliasing is enabled,false
otherwise- Specified by:
isTextAntiAliased
in classGraphicalTerminalImplementation
- Returns:
true
if anti-aliasing is enabled,false
otherwise
-
repaint
protected void repaint()
Description copied from class:GraphicalTerminalImplementation
Called by theGraphicalTerminalImplementation
when it would like the OS to schedule a repaint of the window- Specified by:
repaint
in classGraphicalTerminalImplementation
-
readInput
public KeyStroke readInput()
Description copied from interface:InputProvider
Returns the nextKey
off 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:
readInput
in interfaceInputProvider
- Specified by:
readInput
in interfaceIOSafeTerminal
- Overrides:
readInput
in classGraphicalTerminalImplementation
- Returns:
- Key object which represents a keystroke coming in through the input stream
-
-