Module com.googlecode.lanterna
Package com.googlecode.lanterna.gui2
Class RadioBoxList.RadioBoxListItemRenderer<V>
- java.lang.Object
-
- com.googlecode.lanterna.gui2.AbstractListBox.ListItemRenderer<V,RadioBoxList<V>>
-
- com.googlecode.lanterna.gui2.RadioBoxList.RadioBoxListItemRenderer<V>
-
- Type Parameters:
V- Type of items in theRadioBoxList
- Enclosing class:
- RadioBoxList<V>
public static class RadioBoxList.RadioBoxListItemRenderer<V> extends AbstractListBox.ListItemRenderer<V,RadioBoxList<V>>
Default renderer for this component which is used unless overridden. The selected state is drawn on the left side of the item label using a "< >" block filled with an "o" if the item is the selected one
-
-
Constructor Summary
Constructors Constructor Description RadioBoxListItemRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawItem(TextGUIGraphics graphics, RadioBoxList<V> listBox, int index, V item, boolean selected, boolean focused)This is the main drawing method for a single list box item, it applies the current theme to setup the colors and then callsgetLabel(..)and draws the result using the suppliedTextGUIGraphics.intgetHotSpotPositionOnLine(int selectedIndex)Returns where on the line to place the text terminal cursor for a currently selected item.java.lang.StringgetLabel(RadioBoxList<V> listBox, int index, V item)Given a list box, an index of an item within that list box and what the item is, this method should return what to draw for that item.
-
-
-
Method Detail
-
getHotSpotPositionOnLine
public int getHotSpotPositionOnLine(int selectedIndex)
Description copied from class:AbstractListBox.ListItemRendererReturns where on the line to place the text terminal cursor for a currently selected item. By default this will return 0, meaning the first character of the selected line. If you extendListItemRendereryou can change this by returning a different number. Returning -1 will cause lanterna to hide the cursor.- Overrides:
getHotSpotPositionOnLinein classAbstractListBox.ListItemRenderer<V,RadioBoxList<V>>- Parameters:
selectedIndex- Which item is currently selected- Returns:
- Index of the character in the string we want to place the terminal cursor on, or -1 to hide it
-
getLabel
public java.lang.String getLabel(RadioBoxList<V> listBox, int index, V item)
Description copied from class:AbstractListBox.ListItemRendererGiven a list box, an index of an item within that list box and what the item is, this method should return what to draw for that item. The default implementation is to return whatevertoString()returns when called on the item.- Overrides:
getLabelin classAbstractListBox.ListItemRenderer<V,RadioBoxList<V>>- Parameters:
listBox- List box the item belongs toindex- Index of the itemitem- The item itself- Returns:
- String to draw for this item
-
drawItem
public void drawItem(TextGUIGraphics graphics, RadioBoxList<V> listBox, int index, V item, boolean selected, boolean focused)
Description copied from class:AbstractListBox.ListItemRendererThis is the main drawing method for a single list box item, it applies the current theme to setup the colors and then callsgetLabel(..)and draws the result using the suppliedTextGUIGraphics. The graphics object is created just for this item and is restricted so that it can only draw on the area this item is occupying. The top-left corner (0x0) should be the starting point when drawing the item.- Overrides:
drawItemin classAbstractListBox.ListItemRenderer<V,RadioBoxList<V>>- Parameters:
graphics- Graphics object to draw withlistBox- List box we are drawing an item fromindex- Index of the item we are drawingitem- The item we are drawingselected- Will be set totrueif the item is currently selected, otherwisefalse, but please notice what context 'selected' refers to here (seesetSelectedIndex)focused- Will be set totrueif the list box currently has input focus, otherwisefalse
-
-