- java.lang.Object
-
- com.googlecode.lanterna.gui2.DefaultTextGUIGraphics
-
- All Implemented Interfaces:
StyleSet<TextGraphics>,TextGraphics,ThemedTextGraphics,TextGUIGraphics
public class DefaultTextGUIGraphics extends java.lang.Object implements TextGUIGraphics
Created by Martin on 2017-08-11.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.googlecode.lanterna.graphics.StyleSet
StyleSet.Set
-
-
Field Summary
Fields Modifier and Type Field Description private TextGraphicsbackendprivate TextGUItextGUI
-
Constructor Summary
Constructors Constructor Description DefaultTextGUIGraphics(TextGUI textGUI, TextGraphics backend)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultTextGUIGraphicsapplyThemeStyle(ThemeStyle themeStyle)Takes a ThemeStyle as applies it to this TextGraphics.DefaultTextGUIGraphicsclearModifiers()Removes all active modifiersDefaultTextGUIGraphicsdisableModifiers(SGR... modifiers)Removes zero or more modifiers from the set of currently active modifiersDefaultTextGUIGraphicsdrawImage(TerminalPosition topLeft, TextImage image)Takes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target that is specifying where the top-left corner of the image should be drawn.DefaultTextGUIGraphicsdrawImage(TerminalPosition topLeft, TextImage image, TerminalPosition sourceImageTopLeft, TerminalSize sourceImageSize)Takes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target that is specifying where the top-left corner of the image should be drawn.DefaultTextGUIGraphicsdrawLine(int fromX, int fromY, int toX, int toY, char character)Draws a line from a specified position to a specified position, using a supplied character.DefaultTextGUIGraphicsdrawLine(int fromX, int fromY, int toX, int toY, TextCharacter character)Draws a line from a specified position to a specified position, using a supplied character.DefaultTextGUIGraphicsdrawLine(TerminalPosition fromPoint, TerminalPosition toPoint, char character)Draws a line from a specified position to a specified position, using a supplied character.DefaultTextGUIGraphicsdrawLine(TerminalPosition fromPoint, TerminalPosition toPoint, TextCharacter character)Draws a line from a specified position to a specified position, using a supplied TextCharacter.DefaultTextGUIGraphicsdrawRectangle(TerminalPosition topLeft, TerminalSize size, char character)Draws the outline of a rectangle with a particular character (and the currently active colors and modifiers).DefaultTextGUIGraphicsdrawRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)Draws the outline of a rectangle with a particular TextCharacter, ignoring the current colors and modifiers of this TextGraphics.DefaultTextGUIGraphicsdrawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)Draws the outline of a triangle on the screen, using a supplied character.DefaultTextGUIGraphicsdrawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)Draws the outline of a triangle on the screen, using a supplied character.DefaultTextGUIGraphicsenableModifiers(SGR... modifiers)Adds zero or more modifiers to the set of currently active modifiersDefaultTextGUIGraphicsfill(char c)Fills the entire writable area with a single character, using current foreground color, background color and modifiers.DefaultTextGUIGraphicsfillRectangle(TerminalPosition topLeft, TerminalSize size, char character)Takes a rectangle and fills it with a particular character (and the currently active colors and modifiers).DefaultTextGUIGraphicsfillRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)Takes a rectangle and fills it using a particular TextCharacter, ignoring the current colors and modifiers of this TextGraphics.DefaultTextGUIGraphicsfillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)Draws a filled triangle, using a supplied character.DefaultTextGUIGraphicsfillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)Draws a filled triangle, using a supplied character.java.util.EnumSet<SGR>getActiveModifiers()Returns all the SGR codes that are currently activeTextColorgetBackgroundColor()Returns the current background colorTextCharactergetCharacter(int column, int row)Returns the character at the specific position in the terminal.TextCharactergetCharacter(TerminalPosition position)Returns the character at the specific position in the terminal.TextColorgetForegroundColor()Returns the current foreground colorTerminalSizegetSize()Returns the size of the area that this text graphic can write to.TabBehaviourgetTabBehaviour()Retrieves the current tab behaviour, which is what the TextGraphics will use when expanding \t characters to spaces.TextGUIgetTextGUI()Returns theTextGUIthisTextGUIGraphicsbelongs toDefaultTextGUIGraphicsnewTextGraphics(TerminalPosition topLeftCorner, TerminalSize size)Creates a new TextGraphics of the same type as this one, using the same underlying subsystem.DefaultTextGUIGraphicsputCSIStyledString(int column, int row, java.lang.String string)Puts a string on the screen at the specified position with the current colors and modifiers.DefaultTextGUIGraphicsputCSIStyledString(TerminalPosition position, java.lang.String string)Puts a string on the screen at the specified position with the current colors and modifiers.DefaultTextGUIGraphicsputString(int column, int row, java.lang.String string)Puts a string on the screen at the specified position with the current colors and modifiers.DefaultTextGUIGraphicsputString(int column, int row, java.lang.String string, SGR extraModifier, SGR... optionalExtraModifiers)Puts a string on the screen at the specified position with the current colors and modifiers.DefaultTextGUIGraphicsputString(int column, int row, java.lang.String string, java.util.Collection<SGR> extraModifiers)Puts a string on the screen at the specified position with the current colors and modifiers.DefaultTextGUIGraphicsputString(TerminalPosition position, java.lang.String string)Shortcut to calling:DefaultTextGUIGraphicsputString(TerminalPosition position, java.lang.String string, SGR extraModifier, SGR... optionalExtraModifiers)Shortcut to calling:DefaultTextGUIGraphicssetBackgroundColor(TextColor backgroundColor)Updates the current background colorDefaultTextGUIGraphicssetCharacter(int column, int row, char character)Sets the character at the current position to the specified valueDefaultTextGUIGraphicssetCharacter(int column, int row, TextCharacter character)Sets the character at the current position to the specified value, without using the current colors and modifiers of this TextGraphics.DefaultTextGUIGraphicssetCharacter(TerminalPosition position, char character)Sets the character at the current position to the specified valueDefaultTextGUIGraphicssetCharacter(TerminalPosition position, TextCharacter character)Sets the character at the current position to the specified value, without using the current colors and modifiers of this TextGraphics.DefaultTextGUIGraphicssetForegroundColor(TextColor foregroundColor)Updates the current foreground colorDefaultTextGUIGraphicssetModifiers(java.util.EnumSet<SGR> modifiers)Sets the active modifiers to exactly the set passed in to this method.DefaultTextGUIGraphicssetStyleFrom(StyleSet<?> source)copy colors and set of SGR codesDefaultTextGUIGraphicssetTabBehaviour(TabBehaviour tabBehaviour)Sets the behaviour to use when expanding tab characters (\t) to spaces
-
-
-
Field Detail
-
textGUI
private final TextGUI textGUI
-
backend
private final TextGraphics backend
-
-
Constructor Detail
-
DefaultTextGUIGraphics
DefaultTextGUIGraphics(TextGUI textGUI, TextGraphics backend)
-
-
Method Detail
-
getTextGUI
public TextGUI getTextGUI()
Description copied from interface:TextGUIGraphicsReturns theTextGUIthisTextGUIGraphicsbelongs to- Specified by:
getTextGUIin interfaceTextGUIGraphics- Returns:
TextGUIthisTextGUIGraphicsbelongs to
-
newTextGraphics
public DefaultTextGUIGraphics newTextGraphics(TerminalPosition topLeftCorner, TerminalSize size) throws java.lang.IllegalArgumentException
Description copied from interface:TextGraphicsCreates a new TextGraphics of the same type as this one, using the same underlying subsystem. Using this method, you need to specify a section of the current TextGraphics valid area that this new TextGraphic shall be restricted to. If you callnewTextGraphics(TerminalPosition.TOP_LEFT_CORNER, textGraphics.getSize())then the resulting object will be identical to this one, but having a separated state for colors, position and modifiers.- Specified by:
newTextGraphicsin interfaceTextGraphics- Specified by:
newTextGraphicsin interfaceTextGUIGraphics- Parameters:
topLeftCorner- Position of this TextGraphics's writable area that is to become the top-left corner (0x0) of the new TextGraphicssize- How large area, counted from the topLeftCorner, the new TextGraphics can write to. This cannot be larger than the current TextGraphics's writable area (adjusted by topLeftCorner)- Returns:
- A new TextGraphics with the same underlying subsystem, that can write to only the specified area
- Throws:
java.lang.IllegalArgumentException- If the size the of new TextGraphics exceeds the dimensions of this TextGraphics in any way.
-
applyThemeStyle
public DefaultTextGUIGraphics applyThemeStyle(ThemeStyle themeStyle)
Description copied from interface:ThemedTextGraphicsTakes a ThemeStyle as applies it to this TextGraphics. This will effectively set the foreground color, the background color and all the SGRs.- Specified by:
applyThemeStylein interfaceTextGUIGraphics- Specified by:
applyThemeStylein interfaceThemedTextGraphics- Parameters:
themeStyle- ThemeStyle to apply- Returns:
- Itself
-
getSize
public TerminalSize getSize()
Description copied from interface:TextGraphicsReturns the size of the area that this text graphic can write to. Any attempts of placing characters outside of this area will be silently ignored.- Specified by:
getSizein interfaceTextGraphics- Returns:
- Size of the writable area that this TextGraphics can write too
-
getBackgroundColor
public TextColor getBackgroundColor()
Description copied from interface:StyleSetReturns the current background color- Specified by:
getBackgroundColorin interfaceStyleSet<TextGraphics>- Returns:
- Current background color
-
setBackgroundColor
public DefaultTextGUIGraphics setBackgroundColor(TextColor backgroundColor)
Description copied from interface:StyleSetUpdates the current background color- Specified by:
setBackgroundColorin interfaceStyleSet<TextGraphics>- Specified by:
setBackgroundColorin interfaceTextGUIGraphics- Parameters:
backgroundColor- New background color- Returns:
- Itself
-
getForegroundColor
public TextColor getForegroundColor()
Description copied from interface:StyleSetReturns the current foreground color- Specified by:
getForegroundColorin interfaceStyleSet<TextGraphics>- Returns:
- Current foreground color
-
setForegroundColor
public DefaultTextGUIGraphics setForegroundColor(TextColor foregroundColor)
Description copied from interface:StyleSetUpdates the current foreground color- Specified by:
setForegroundColorin interfaceStyleSet<TextGraphics>- Specified by:
setForegroundColorin interfaceTextGUIGraphics- Parameters:
foregroundColor- New foreground color- Returns:
- Itself
-
enableModifiers
public DefaultTextGUIGraphics enableModifiers(SGR... modifiers)
Description copied from interface:StyleSetAdds zero or more modifiers to the set of currently active modifiers- Specified by:
enableModifiersin interfaceStyleSet<TextGraphics>- Specified by:
enableModifiersin interfaceTextGUIGraphics- Parameters:
modifiers- Modifiers to add to the set of currently active modifiers- Returns:
- Itself
-
disableModifiers
public DefaultTextGUIGraphics disableModifiers(SGR... modifiers)
Description copied from interface:StyleSetRemoves zero or more modifiers from the set of currently active modifiers- Specified by:
disableModifiersin interfaceStyleSet<TextGraphics>- Specified by:
disableModifiersin interfaceTextGUIGraphics- Parameters:
modifiers- Modifiers to remove from the set of currently active modifiers- Returns:
- Itself
-
setModifiers
public DefaultTextGUIGraphics setModifiers(java.util.EnumSet<SGR> modifiers)
Description copied from interface:StyleSetSets the active modifiers to exactly the set passed in to this method. Any previous state of which modifiers are enabled doesn't matter.- Specified by:
setModifiersin interfaceStyleSet<TextGraphics>- Specified by:
setModifiersin interfaceTextGUIGraphics- Parameters:
modifiers- Modifiers to set as active- Returns:
- Itself
-
clearModifiers
public DefaultTextGUIGraphics clearModifiers()
Description copied from interface:StyleSetRemoves all active modifiers- Specified by:
clearModifiersin interfaceStyleSet<TextGraphics>- Specified by:
clearModifiersin interfaceTextGUIGraphics- Returns:
- Itself
-
getActiveModifiers
public java.util.EnumSet<SGR> getActiveModifiers()
Description copied from interface:StyleSetReturns all the SGR codes that are currently active- Specified by:
getActiveModifiersin interfaceStyleSet<TextGraphics>- Returns:
- Currently active SGR modifiers
-
getTabBehaviour
public TabBehaviour getTabBehaviour()
Description copied from interface:TextGraphicsRetrieves the current tab behaviour, which is what the TextGraphics will use when expanding \t characters to spaces.- Specified by:
getTabBehaviourin interfaceTextGraphics- Returns:
- Current behaviour in use for expanding tab to spaces
-
setTabBehaviour
public DefaultTextGUIGraphics setTabBehaviour(TabBehaviour tabBehaviour)
Description copied from interface:TextGraphicsSets the behaviour to use when expanding tab characters (\t) to spaces- Specified by:
setTabBehaviourin interfaceTextGraphics- Specified by:
setTabBehaviourin interfaceTextGUIGraphics- Parameters:
tabBehaviour- Behaviour to use when expanding tabs to spaces- Returns:
- Itself
-
fill
public DefaultTextGUIGraphics fill(char c)
Description copied from interface:TextGraphicsFills the entire writable area with a single character, using current foreground color, background color and modifiers.- Specified by:
fillin interfaceTextGraphics- Specified by:
fillin interfaceTextGUIGraphics- Parameters:
c- Character to fill the writable area with- Returns:
- Itself
-
fillRectangle
public DefaultTextGUIGraphics fillRectangle(TerminalPosition topLeft, TerminalSize size, char character)
Description copied from interface:TextGraphicsTakes a rectangle and fills it with a particular character (and the currently active colors and modifiers). The topLeft coordinate is inclusive.For example, calling fillRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will fill the entire terminal with this character.
The current foreground color, background color and modifiers will be applied.
- Specified by:
fillRectanglein interfaceTextGraphics- Specified by:
fillRectanglein interfaceTextGUIGraphics- Parameters:
topLeft- Coordinates of the top-left position of the rectanglesize- Size (in columns and rows) of the area to drawcharacter- What character to use when filling the rectangle- Returns:
- Itself
-
fillRectangle
public DefaultTextGUIGraphics fillRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)
Description copied from interface:TextGraphicsTakes a rectangle and fills it using a particular TextCharacter, ignoring the current colors and modifiers of this TextGraphics. The topLeft coordinate is inclusive.For example, calling fillRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will fill the entire terminal with this character.
The current foreground color, background color and modifiers will not be modified by this call.
- Specified by:
fillRectanglein interfaceTextGraphics- Specified by:
fillRectanglein interfaceTextGUIGraphics- Parameters:
topLeft- Coordinates of the top-left position of the rectanglesize- Size (in columns and rows) of the area to drawcharacter- What character data to use when filling the rectangle- Returns:
- Itself
-
drawRectangle
public DefaultTextGUIGraphics drawRectangle(TerminalPosition topLeft, TerminalSize size, char character)
Description copied from interface:TextGraphicsDraws the outline of a rectangle with a particular character (and the currently active colors and modifiers). The topLeft coordinate is inclusive.For example, calling drawRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will draw a border around the terminal.
The current foreground color, background color and modifiers will be applied.
- Specified by:
drawRectanglein interfaceTextGraphics- Specified by:
drawRectanglein interfaceTextGUIGraphics- Parameters:
topLeft- Coordinates of the top-left position of the rectanglesize- Size (in columns and rows) of the area to drawcharacter- What character to use when drawing the outline of the rectangle- Returns:
- Itself
-
drawRectangle
public DefaultTextGUIGraphics drawRectangle(TerminalPosition topLeft, TerminalSize size, TextCharacter character)
Description copied from interface:TextGraphicsDraws the outline of a rectangle with a particular TextCharacter, ignoring the current colors and modifiers of this TextGraphics.For example, calling drawRectangle with size being the size of the terminal and top-left value being the terminal's top-left (0x0) corner will draw a border around the terminal.
The current foreground color, background color and modifiers will not be modified by this call.
- Specified by:
drawRectanglein interfaceTextGraphics- Specified by:
drawRectanglein interfaceTextGUIGraphics- Parameters:
topLeft- Coordinates of the top-left position of the rectanglesize- Size (in columns and rows) of the area to drawcharacter- What character data to use when drawing the outline of the rectangle- Returns:
- Itself
-
fillTriangle
public DefaultTextGUIGraphics fillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)
Description copied from interface:TextGraphicsDraws a filled triangle, using a supplied character. The triangle will begin at p1, go through p2 and then p3 and then back to p1. The current foreground color, background color and modifiers will be applied.- Specified by:
fillTrianglein interfaceTextGraphics- Specified by:
fillTrianglein interfaceTextGUIGraphics- Parameters:
p1- First point on the screen of the trianglep2- Second point on the screen of the trianglep3- Third point on the screen of the trianglecharacter- What character to use when drawing the triangle- Returns:
- Itself
-
fillTriangle
public DefaultTextGUIGraphics fillTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)
Description copied from interface:TextGraphicsDraws a filled triangle, using a supplied character. The triangle will begin at p1, go through p2 and then p3 and then back to p1. The current foreground color, background color and modifiers of this TextGraphics will not be used and will not be modified by this call.- Specified by:
fillTrianglein interfaceTextGraphics- Specified by:
fillTrianglein interfaceTextGUIGraphics- Parameters:
p1- First point on the screen of the trianglep2- Second point on the screen of the trianglep3- Third point on the screen of the trianglecharacter- What character data to use when drawing the triangle- Returns:
- Itself
-
drawTriangle
public DefaultTextGUIGraphics drawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, char character)
Description copied from interface:TextGraphicsDraws the outline of a triangle on the screen, using a supplied character. The triangle will begin at p1, go through p2 and then p3 and then back to p1. The current foreground color, background color and modifiers will be applied.- Specified by:
drawTrianglein interfaceTextGraphics- Specified by:
drawTrianglein interfaceTextGUIGraphics- Parameters:
p1- First point on the screen of the trianglep2- Second point on the screen of the trianglep3- Third point on the screen of the trianglecharacter- What character to use when drawing the lines of the triangle- Returns:
- Itself
-
drawTriangle
public DefaultTextGUIGraphics drawTriangle(TerminalPosition p1, TerminalPosition p2, TerminalPosition p3, TextCharacter character)
Description copied from interface:TextGraphicsDraws the outline of a triangle on the screen, using a supplied character. The triangle will begin at p1, go through p2 and then p3 and then back to p1. The current foreground color, background color and modifiers of this TextGraphics will not be used and will not be modified by this call.- Specified by:
drawTrianglein interfaceTextGraphics- Specified by:
drawTrianglein interfaceTextGUIGraphics- Parameters:
p1- First point on the screen of the trianglep2- Second point on the screen of the trianglep3- Third point on the screen of the trianglecharacter- What character data to use when drawing the lines of the triangle- Returns:
- Itself
-
drawLine
public DefaultTextGUIGraphics drawLine(TerminalPosition fromPoint, TerminalPosition toPoint, char character)
Description copied from interface:TextGraphicsDraws a line from a specified position to a specified position, using a supplied character. The current foreground color, background color and modifiers will be applied.- Specified by:
drawLinein interfaceTextGraphics- Specified by:
drawLinein interfaceTextGUIGraphics- Parameters:
fromPoint- From where to draw the linetoPoint- Where to draw the linecharacter- Character to use for the line- Returns:
- Itself
-
drawLine
public DefaultTextGUIGraphics drawLine(TerminalPosition fromPoint, TerminalPosition toPoint, TextCharacter character)
Description copied from interface:TextGraphicsDraws a line from a specified position to a specified position, using a supplied TextCharacter. The current foreground color, background color and modifiers of this TextGraphics will not be used and will not be modified by this call.- Specified by:
drawLinein interfaceTextGraphics- Specified by:
drawLinein interfaceTextGUIGraphics- Parameters:
fromPoint- From where to draw the linetoPoint- Where to draw the linecharacter- Character data to use for the line, including character, colors and modifiers- Returns:
- Itself
-
drawLine
public DefaultTextGUIGraphics drawLine(int fromX, int fromY, int toX, int toY, char character)
Description copied from interface:TextGraphicsDraws a line from a specified position to a specified position, using a supplied character. The current foreground color, background color and modifiers will be applied.- Specified by:
drawLinein interfaceTextGraphics- Specified by:
drawLinein interfaceTextGUIGraphics- Parameters:
fromX- Column of the starting position to draw the line from (inclusive)fromY- Row of the starting position to draw the line from (inclusive)toX- Column of the end position to draw the line to (inclusive)toY- Row of the end position to draw the line to (inclusive)character- Character to use for the line- Returns:
- Itself
-
drawLine
public DefaultTextGUIGraphics drawLine(int fromX, int fromY, int toX, int toY, TextCharacter character)
Description copied from interface:TextGraphicsDraws a line from a specified position to a specified position, using a supplied character. The current foreground color, background color and modifiers of this TextGraphics will not be used and will not be modified by this call.- Specified by:
drawLinein interfaceTextGraphics- Specified by:
drawLinein interfaceTextGUIGraphics- Parameters:
fromX- Column of the starting position to draw the line from (inclusive)fromY- Row of the starting position to draw the line from (inclusive)toX- Column of the end position to draw the line to (inclusive)toY- Row of the end position to draw the line to (inclusive)character- Character data to use for the line, including character, colors and modifiers- Returns:
- Itself
-
drawImage
public DefaultTextGUIGraphics drawImage(TerminalPosition topLeft, TextImage image)
Description copied from interface:TextGraphicsTakes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target that is specifying where the top-left corner of the image should be drawn. This is equivalent of callingdrawImage(topLeft, image, TerminalPosition.TOP_LEFT_CORNER, image.getSize().- Specified by:
drawImagein interfaceTextGraphics- Specified by:
drawImagein interfaceTextGUIGraphics- Parameters:
topLeft- Position of the top-left corner of the image on the targetimage- Image to draw- Returns:
- Itself
-
drawImage
public DefaultTextGUIGraphics drawImage(TerminalPosition topLeft, TextImage image, TerminalPosition sourceImageTopLeft, TerminalSize sourceImageSize)
Description copied from interface:TextGraphicsTakes a TextImage and draws it on the surface this TextGraphics is targeting, given the coordinates on the target that is specifying where the top-left corner of the image should be drawn. This overload will only draw a portion of the image to the target, as specified by the two last parameters.- Specified by:
drawImagein interfaceTextGraphics- Specified by:
drawImagein interfaceTextGUIGraphics- Parameters:
topLeft- Position of the top-left corner of the image on the targetimage- Image to drawsourceImageTopLeft- Position of the top-left corner in the source image to draw at the topLeft position on the targetsourceImageSize- How much of the source image to draw on the target, counted from the sourceImageTopLeft position- Returns:
- Itself
-
setCharacter
public DefaultTextGUIGraphics setCharacter(TerminalPosition position, char character)
Description copied from interface:TextGraphicsSets the character at the current position to the specified value- Specified by:
setCharacterin interfaceTextGraphics- Specified by:
setCharacterin interfaceTextGUIGraphics- Parameters:
position- position of the location to set the charactercharacter- Character to set at the current position- Returns:
- Itself
-
setCharacter
public DefaultTextGUIGraphics setCharacter(TerminalPosition position, TextCharacter character)
Description copied from interface:TextGraphicsSets the character at the current position to the specified value, without using the current colors and modifiers of this TextGraphics.- Specified by:
setCharacterin interfaceTextGraphics- Specified by:
setCharacterin interfaceTextGUIGraphics- Parameters:
position- position of the location to set the charactercharacter- Character data to set at the current position- Returns:
- Itself
-
setCharacter
public DefaultTextGUIGraphics setCharacter(int column, int row, char character)
Description copied from interface:TextGraphicsSets the character at the current position to the specified value- Specified by:
setCharacterin interfaceTextGraphics- Specified by:
setCharacterin interfaceTextGUIGraphics- Parameters:
column- column of the location to set the characterrow- row of the location to set the charactercharacter- Character to set at the current position- Returns:
- Itself
-
setCharacter
public DefaultTextGUIGraphics setCharacter(int column, int row, TextCharacter character)
Description copied from interface:TextGraphicsSets the character at the current position to the specified value, without using the current colors and modifiers of this TextGraphics.- Specified by:
setCharacterin interfaceTextGraphics- Specified by:
setCharacterin interfaceTextGUIGraphics- Parameters:
column- column of the location to set the characterrow- row of the location to set the charactercharacter- Character data to set at the current position- Returns:
- Itself
-
putString
public DefaultTextGUIGraphics putString(int column, int row, java.lang.String string)
Description copied from interface:TextGraphicsPuts a string on the screen at the specified position with the current colors and modifiers. If the string contains newlines (\r and/or \n), the method will stop at the character before that; you have to manage multi-line strings yourself! The current foreground color, background color and modifiers will be applied.- Specified by:
putStringin interfaceTextGraphics- Specified by:
putStringin interfaceTextGUIGraphics- Parameters:
column- What column to put the string atrow- What row to put the string atstring- String to put on the screen- Returns:
- Itself
-
putString
public DefaultTextGUIGraphics putString(TerminalPosition position, java.lang.String string)
Description copied from interface:TextGraphicsShortcut to calling:putString(position.getColumn(), position.getRow(), string);
- Specified by:
putStringin interfaceTextGraphics- Specified by:
putStringin interfaceTextGUIGraphics- Parameters:
position- Position to put the string atstring- String to put on the screen- Returns:
- Itself
-
putString
public DefaultTextGUIGraphics putString(int column, int row, java.lang.String string, SGR extraModifier, SGR... optionalExtraModifiers)
Description copied from interface:TextGraphicsPuts a string on the screen at the specified position with the current colors and modifiers. If the string contains newlines (\r and/or \n), the method will stop at the character before that; you have to manage multi-line strings yourself! If you supplied any extra modifiers, they will be applied when writing the string as well but not recorded into the state of the TextGraphics object.- Specified by:
putStringin interfaceTextGraphics- Specified by:
putStringin interfaceTextGUIGraphics- Parameters:
column- What column to put the string atrow- What row to put the string atstring- String to put on the screenextraModifier- Modifier to apply to the stringoptionalExtraModifiers- Optional extra modifiers to apply to the string- Returns:
- Itself
-
putString
public DefaultTextGUIGraphics putString(TerminalPosition position, java.lang.String string, SGR extraModifier, SGR... optionalExtraModifiers)
Description copied from interface:TextGraphicsShortcut to calling:putString(position.getColumn(), position.getRow(), string, modifiers, optionalExtraModifiers);
- Specified by:
putStringin interfaceTextGraphics- Specified by:
putStringin interfaceTextGUIGraphics- Parameters:
position- Position to put the string atstring- String to put on the screenextraModifier- Modifier to apply to the stringoptionalExtraModifiers- Optional extra modifiers to apply to the string- Returns:
- Itself
-
putString
public DefaultTextGUIGraphics putString(int column, int row, java.lang.String string, java.util.Collection<SGR> extraModifiers)
Description copied from interface:TextGraphicsPuts a string on the screen at the specified position with the current colors and modifiers. If the string contains newlines (\r and/or \n), the method will stop at the character before that; you have to manage multi-line strings yourself! If you supplied any extra modifiers, they will be applied when writing the string as well but not recorded into the state of the TextGraphics object.- Specified by:
putStringin interfaceTextGraphics- Specified by:
putStringin interfaceTextGUIGraphics- Parameters:
column- What column to put the string atrow- What row to put the string atstring- String to put on the screenextraModifiers- Modifier to apply to the string- Returns:
- Itself
-
putCSIStyledString
public DefaultTextGUIGraphics putCSIStyledString(int column, int row, java.lang.String string)
Description copied from interface:TextGraphicsPuts a string on the screen at the specified position with the current colors and modifiers. If the string contains newlines (\r and/or \n), the method will stop at the character before that; you have to manage multi-line strings yourself!This method has an additional functionality to the regular
TextGraphics.putString(int, int, String); if you embed ANSI CSI-style control sequences (like modifying text color or controlling SGR status), they will be interpreted as the string is printed and mutates theTextGraphicsobject. In this version of Lanterna, the following sequences are supported:- Set foreground color
- Set background color
- Set/Clear bold style
- Set/Clear underline style
- Set/Clear blink style
- Set/Clear reverse style
- Clear all styles and colors (notice that this will return the state to what it was at the start of the method)
TextGraphicsobject will return to the color/style state it was in at the start of the call.- Specified by:
putCSIStyledStringin interfaceTextGraphics- Specified by:
putCSIStyledStringin interfaceTextGUIGraphics- Parameters:
column- What column to put the string atrow- What row to put the string atstring- String to put on the screen- Returns:
- Itself
-
putCSIStyledString
public DefaultTextGUIGraphics putCSIStyledString(TerminalPosition position, java.lang.String string)
Description copied from interface:TextGraphicsPuts a string on the screen at the specified position with the current colors and modifiers. If the string contains newlines (\r and/or \n), the method will stop at the character before that; you have to manage multi-line strings yourself!This method has an additional functionality to the regular
TextGraphics.putString(int, int, String); if you embed ANSI CSI-style control sequences (like modifying text color or controlling SGR status), they will be interpreted as the string is printed and mutates theTextGraphicsobject. In this version of Lanterna, the following sequences are supported:- Set foreground color
- Set background color
- Set/Clear bold style
- Set/Clear underline style
- Set/Clear blink style
- Set/Clear reverse style
- Clear all styles and colors (notice that this will return the state to what it was at the start of the method)
TextGraphicsobject will return to the color/style state it was in at the start of the call.- Specified by:
putCSIStyledStringin interfaceTextGraphics- Specified by:
putCSIStyledStringin interfaceTextGUIGraphics- Parameters:
position- Position to put the string atstring- String to put on the screen- Returns:
- Itself
-
getCharacter
public TextCharacter getCharacter(int column, int row)
Description copied from interface:TextGraphicsReturns the character at the specific position in the terminal. May returnnullif the TextGraphics implementation doesn't support it or doesn't know what the character is.- Specified by:
getCharacterin interfaceTextGraphics- Parameters:
column- Column to return the character forrow- Row to return the character for- Returns:
- The text character at the specified position or
nullif not available
-
getCharacter
public TextCharacter getCharacter(TerminalPosition position)
Description copied from interface:TextGraphicsReturns the character at the specific position in the terminal. May returnnullif the TextGraphics implementation doesn't support it or doesn't know what the character is.- Specified by:
getCharacterin interfaceTextGraphics- Parameters:
position- Position to return the character for- Returns:
- The text character at the specified position or
nullif not available
-
setStyleFrom
public DefaultTextGUIGraphics setStyleFrom(StyleSet<?> source)
Description copied from interface:StyleSetcopy colors and set of SGR codes- Specified by:
setStyleFromin interfaceStyleSet<TextGraphics>- Specified by:
setStyleFromin interfaceTextGUIGraphics- Parameters:
source- Modifiers to set as active- Returns:
- Itself
-
-