public class ListField extends GuiComponent
ICON_FONT
Constructor and Description |
---|
ListField(double x,
double y,
double width,
double height,
java.lang.Object[][] content,
int shownRows,
int shownColumns)
Creates a 2D vertical list field.
|
ListField(double x,
double y,
double width,
double height,
java.lang.Object[] content,
int shownRows)
Creates a vertical list field.
|
Modifier and Type | Method and Description |
---|---|
void |
deselect()
Resets the ListField's selection to
null . |
Spritesheet |
getButtonSprite() |
java.util.List<java.util.function.IntConsumer> |
getChangeConsumer() |
java.lang.Object[][] |
getContent() |
Spritesheet |
getEntrySprite() |
int |
getHorizontalLowerBound() |
HorizontalSlider |
getHorizontalSlider() |
java.util.List<ImageComponent> |
getListEntry(int column)
Returns all list items of a specified column.
|
ImageComponent |
getListEntry(int column,
int row)
Returns item at a specified column and row.
|
int |
getMaxRows()
Returns the number of rows of the tallest column.
|
int |
getNumberOfShownColumns() |
int |
getNumberOfShownRows() |
ImageComponent |
getSelectedComponent() |
java.lang.Object |
getSelectedObject() |
int |
getSelectionColumn()
Returns the selected column.
|
int |
getSelectionRow()
Returns the selected row.
|
int |
getVerticalLowerBound() |
VerticalSlider |
getVerticalSlider() |
boolean |
isArrowKeyNavigation() |
boolean |
isEntireColumnSelected()
|
boolean |
isEntireRowSelected()
|
boolean |
isSliderInside()
Verify if sliders are set to be inside the ListField.
|
void |
onChange(java.util.function.IntConsumer c) |
void |
refresh() |
void |
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.
|
void |
setArrowKeyNavigation(boolean arrowKeyNavigation) |
void |
setButtonSprite(Spritesheet buttonSprite) |
void |
setEntrySprite(Spritesheet entrySprite) |
void |
setForwardMouseEvents(int column,
boolean forwardMouseEvents) |
void |
setHorizontalLowerBound(int lowerBound) |
void |
setSelectEntireColumn(boolean selectEntireColumn)
If set to true, selecting a element will show a selection of
the entire column on which that element is on.
|
void |
setSelectEntireRow(boolean selectEntireRow)
If set to true, selecting a element will show a selection of
the entire row on which that element is on.
|
void |
setSelection(int column,
int row) |
void |
setSliderInside(boolean sliderInside)
If set to true, the sliders of this ListField will be displayed within its boundaries.
|
void |
setVerticalLowerBound(int lowerBound) |
void |
slideDown()
Slides the ListField down by one row.
|
void |
slideUp()
Slides the ListField up by one row.
|
drawTextShadow, getAppearance, getAppearanceDisabled, getAppearanceHovered, getBoundingBox, getClickConsumer, getComponentId, getComponents, getCurrentAppearance, getFont, getHeight, getHorizontalTextMargin, getHoverConsumer, getHoverSound, getLocation, getMouseDraggedConsumer, getMouseEnterConsumer, getMouseLeaveConsumer, getMouseMovedConsumer, getMousePressedConsumer, getMouseReleasedConsumer, getMouseWheelConsumer, getName, getShape, getTag, getText, getTextAlign, getTextAngle, getTextShadowColor, getTextToRender, getTextX, getTextY, getWidth, getX, getY, initializeComponents, isEnabled, isForwardMouseEvents, isHovered, isPressed, isSelected, isSuspended, isVisible, mouseClicked, mouseDragged, mouseEntered, mouseEventShouldBeForwarded, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, onClicked, onHovered, onMouseDragged, onMouseEnter, onMouseLeave, onMouseMoved, onMousePressed, onMouseReleased, onMouseWheelScrolled, onTextChanged, prepare, setDimension, setEnabled, setFont, setFontSize, setForwardMouseEvents, setHeight, setHorizontalTextMargin, setHovered, setHoverSound, setLocation, setLocation, setName, setSelected, setTag, setText, setTextAlign, setTextAngle, setTextShadow, setTextShadowColor, setTextX, setTextY, setVisible, setWidth, setX, setY, suspend, toggleSelection, toggleSuspension
public ListField(double x, double y, double width, double height, java.lang.Object[] content, int shownRows)
content[0][0] - ok
content[0][1] - ok
content[0][8] - ok
content[1][5] - NOK
content[2][0] - NOK
x
- The x-coordinate of the ListField.y
- The y-coordinate of the ListField.width
- The width of the ListField.height
- The height of the ListField.content
- The 1 dimension array to show in the ListField.shownRows
- The number of rows/elements to
display before the user needs to scroll for more possible rows/elements.ListField(double, double, double, double, Object[], int)
public ListField(double x, double y, double width, double height, java.lang.Object[][] content, int shownRows, int shownColumns)
content[0][0] - column 0, row 0
content[0][1] - column 0, row 1
content[2][8] - column 2, row 8
x
- The x-coordinate of the ListField.y
- The y-coordinate of the ListField.width
- The width of the ListField.height
- The height of the ListField.content
- The 2 dimension array to show in the ListField.shownRows
- The number of rows to
display before the user needs to scroll for more possible rows.shownColumns
- The number of columns to
display before the user needs to scroll for more possible columns.public void deselect()
null
.
public Spritesheet getButtonSprite()
public java.util.List<java.util.function.IntConsumer> getChangeConsumer()
public java.lang.Object[][] getContent()
public Spritesheet getEntrySprite()
public int getHorizontalLowerBound()
public HorizontalSlider getHorizontalSlider()
public java.util.List<ImageComponent> getListEntry(int column)
column
- the columnpublic ImageComponent getListEntry(int column, int row)
column
- the columnrow
- the rowpublic int getMaxRows()
public int getNumberOfShownRows()
public int getNumberOfShownColumns()
public ImageComponent getSelectedComponent()
public java.lang.Object getSelectedObject()
public int getSelectionColumn()
public int getSelectionRow()
public int getVerticalLowerBound()
public VerticalSlider getVerticalSlider()
public boolean isArrowKeyNavigation()
public void onChange(java.util.function.IntConsumer c)
public void refresh()
public void render(java.awt.Graphics2D g)
IRenderable
If an Entity
implements this interface, this method will be called right after the entity was rendered from the environment.
Allowing for a custom rendering mechanism.
This interface can be implemented in general by anything that should be rendered to the game's screen.
render
in interface IRenderable
render
in class GuiComponent
g
- The current graphics object onto which this instance will render its visual contents.RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
public void setArrowKeyNavigation(boolean arrowKeyNavigation)
public void setButtonSprite(Spritesheet buttonSprite)
public void setEntrySprite(Spritesheet entrySprite)
public void setForwardMouseEvents(int column, boolean forwardMouseEvents)
public void setHorizontalLowerBound(int lowerBound)
public void setSelection(int column, int row)
public void setSelectEntireColumn(boolean selectEntireColumn)
selectEntireColumn
- a booleanpublic void setSliderInside(boolean sliderInside)
sliderInside
- a booleanpublic void setSelectEntireRow(boolean selectEntireRow)
selectEntireRow
- a booleanpublic void setVerticalLowerBound(int lowerBound)
public boolean isEntireColumnSelected()
public boolean isEntireRowSelected()
public boolean isSliderInside()
public void slideUp()
public void slideDown()