- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractComponent<EmptySpace>
-
- com.googlecode.lanterna.gui2.EmptySpace
-
- All Implemented Interfaces:
Component
,TextGUIElement
- Direct Known Subclasses:
GUIBackdrop
public class EmptySpace extends AbstractComponent<EmptySpace>
Simple component which draws a solid color over its area. The size this component will request is specified through it's constructor.
-
-
Field Summary
Fields Modifier and Type Field Description private TextColor
color
private TerminalSize
size
-
Constructor Summary
Constructors Constructor Description EmptySpace()
Creates an EmptySpace with size 1x1 and a default color chosen from the themeEmptySpace(TerminalSize size)
Creates an EmptySpace with a specified preferred size (color will be chosen from the theme)EmptySpace(TextColor color)
Creates an EmptySpace with a specified color and preferred size of 1x1EmptySpace(TextColor color, TerminalSize size)
Creates an EmptySpace with a specified color (null will make it use a color from the theme) and preferred size
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentRenderer<EmptySpace>
createDefaultRenderer()
When you create a custom component, you need to implement this method and return a Renderer which is responsible for taking care of sizing the component, rendering it and choosing where to place the cursor (if Interactable).TextColor
getColor()
Returns the color this component is drawn with, ornull
if this component uses whatever the default color the theme is set to usevoid
setColor(TextColor color)
Changes the color this component will use when drawn-
Methods inherited from class com.googlecode.lanterna.gui2.AbstractComponent
addTo, calculatePreferredSize, draw, getBasePane, getGlobalPosition, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, isInvalid, isVisible, onAdded, onAfterDrawing, onBeforeDrawing, onRemoved, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, setVisible, toBasePane, toGlobal, withBorder
-
-
-
-
Field Detail
-
size
private final TerminalSize size
-
color
private TextColor color
-
-
Constructor Detail
-
EmptySpace
public EmptySpace()
Creates an EmptySpace with size 1x1 and a default color chosen from the theme
-
EmptySpace
public EmptySpace(TextColor color)
Creates an EmptySpace with a specified color and preferred size of 1x1- Parameters:
color
- Color to use (null will make it use the theme)
-
EmptySpace
public EmptySpace(TerminalSize size)
Creates an EmptySpace with a specified preferred size (color will be chosen from the theme)- Parameters:
size
- Preferred size
-
EmptySpace
public EmptySpace(TextColor color, TerminalSize size)
Creates an EmptySpace with a specified color (null will make it use a color from the theme) and preferred size- Parameters:
color
- Color to use (null will make it use the theme)size
- Preferred size
-
-
Method Detail
-
setColor
public void setColor(TextColor color)
Changes the color this component will use when drawn- Parameters:
color
- New color to draw the component with, ifnull
then the component will use the theme's default color
-
getColor
public TextColor getColor()
Returns the color this component is drawn with, ornull
if this component uses whatever the default color the theme is set to use- Returns:
- Color used when drawing or
null
if it's using the theme
-
createDefaultRenderer
protected ComponentRenderer<EmptySpace> createDefaultRenderer()
Description copied from class:AbstractComponent
When you create a custom component, you need to implement this method and return a Renderer which is responsible for taking care of sizing the component, rendering it and choosing where to place the cursor (if Interactable). This value is intended to be overridden by custom themes.- Specified by:
createDefaultRenderer
in classAbstractComponent<EmptySpace>
- Returns:
- Renderer to use when sizing and drawing this component
-
-