- All Implemented Interfaces:
Component
,TextGUIElement
- Direct Known Subclasses:
GUIBackdrop
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 -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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
Modifier and TypeMethodDescriptionprotected ComponentRenderer
<EmptySpace> 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).getColor()
Returns the color this component is drawn with, ornull
if this component uses whatever the default color the theme is set to usevoid
Changes the color this component will use when drawnMethods 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 Details
-
size
-
color
-
-
Constructor Details
-
EmptySpace
public EmptySpace()Creates an EmptySpace with size 1x1 and a default color chosen from the theme -
EmptySpace
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
Creates an EmptySpace with a specified preferred size (color will be chosen from the theme)- Parameters:
size
- Preferred size
-
EmptySpace
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 Details
-
setColor
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
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
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
-