Module com.googlecode.lanterna
Package com.googlecode.lanterna.gui2
Class Button.DefaultButtonRenderer
- java.lang.Object
-
- com.googlecode.lanterna.gui2.Button.DefaultButtonRenderer
-
- All Implemented Interfaces:
Button.ButtonRenderer
,ComponentRenderer<Button>
,InteractableRenderer<Button>
- Enclosing class:
- Button
public static class Button.DefaultButtonRenderer extends java.lang.Object implements Button.ButtonRenderer
This is the default button renderer that is used if you don't override anything. With this renderer, buttons are drawn on a single line, with the label inside of "<" and ">".
-
-
Constructor Summary
Constructors Constructor Description DefaultButtonRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
drawComponent(TextGUIGraphics graphics, Button button)
Using the supplied graphics object, draws the component passed in.TerminalPosition
getCursorLocation(Button button)
private int
getLabelShift(Button button, TerminalSize size)
TerminalSize
getPreferredSize(Button button)
Given the supplied component, how large does this renderer want the component to be? Notice that this is the responsibility of the renderer and not the component itself, since the component has no idea what its visual representation looks like.
-
-
-
Method Detail
-
getCursorLocation
public TerminalPosition getCursorLocation(Button button)
- Specified by:
getCursorLocation
in interfaceInteractableRenderer<Button>
-
getPreferredSize
public TerminalSize getPreferredSize(Button button)
Description copied from interface:ComponentRenderer
Given the supplied component, how large does this renderer want the component to be? Notice that this is the responsibility of the renderer and not the component itself, since the component has no idea what its visual representation looks like.- Specified by:
getPreferredSize
in interfaceComponentRenderer<Button>
- Parameters:
button
- Component to calculate the preferred size of- Returns:
- The size this renderer would like the component to take up
-
drawComponent
public void drawComponent(TextGUIGraphics graphics, Button button)
Description copied from interface:ComponentRenderer
Using the supplied graphics object, draws the component passed in.- Specified by:
drawComponent
in interfaceComponentRenderer<Button>
- Parameters:
graphics
- Graphics object to use for drawingbutton
- Component to draw
-
getLabelShift
private int getLabelShift(Button button, TerminalSize size)
-
-