Class List<T>

    • Constructor Detail

      • List

        public List​(Skin skin)
      • List

        public List​(Skin skin,
                    java.lang.String styleName)
    • Method Detail

      • layout

        public void layout()
        Description copied from interface: Layout
        Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls Layout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each child. This method should almost never be called directly, instead Layout.validate() should be used.
        Specified by:
        layout in interface Layout
        Overrides:
        layout in class Widget
      • draw

        public void draw​(Batch batch,
                         float parentAlpha)
        Description copied from class: Widget
        If this method is overridden, the super method or Widget.validate() should be called to ensure the widget is laid out.
        Overrides:
        draw in class Widget
        parentAlpha - The parent alpha, to be multiplied with this actor's alpha, allowing the parent's alpha to affect all children.
      • drawSelection

        protected void drawSelection​(Batch batch,
                                     @Null
                                     Drawable drawable,
                                     float x,
                                     float y,
                                     float width,
                                     float height)
      • drawBackground

        protected void drawBackground​(Batch batch,
                                      float parentAlpha)
        Called to draw the background. Default implementation draws the style background drawable.
      • getSelected

        @Null
        public T getSelected()
        Returns the first selected item, or null.
      • setSelected

        public void setSelected​(@Null
                                T item)
        Sets the selection to only the passed item, if it is a possible choice.
        Parameters:
        item - May be null.
      • getSelectedIndex

        public int getSelectedIndex()
        Returns:
        The index of the first selected item. The top item has an index of 0. Nothing selected has an index of -1.
      • setSelectedIndex

        public void setSelectedIndex​(int index)
        Sets the selection to only the selected index.
        Parameters:
        index - -1 to clear the selection.
      • getOverItem

        public T getOverItem()
        Returns:
        May be null.
      • getPressedItem

        public T getPressedItem()
        Returns:
        May be null.
      • getItemAt

        @Null
        public T getItemAt​(float y)
        Returns:
        null if not over an item.
      • getItemIndexAt

        public int getItemIndexAt​(float y)
        Returns:
        -1 if not over an item.
      • setItems

        public void setItems​(T... newItems)
      • setItems

        public void setItems​(Array newItems)
        Sets the items visible in the list, clearing the selection if it is no longer valid. If a selection is Selection.getRequired(), the first item is selected. This can safely be called with a (modified) array returned from getItems().
      • clearItems

        public void clearItems()
      • getItems

        public Array<T> getItems()
        Returns the internal items array. If modified, setItems(Array) must be called to reflect the changes.
      • getItemHeight

        public float getItemHeight()
      • toString

        public java.lang.String toString​(T object)
      • setCullingArea

        public void setCullingArea​(@Null
                                   Rectangle cullingArea)
        Specified by:
        setCullingArea in interface Cullable
        Parameters:
        cullingArea - The culling area in the child actor's coordinates.
      • setAlignment

        public void setAlignment​(int alignment)
        Sets the horizontal alignment of the list items.
        Parameters:
        alignment - See Align.
      • getAlignment

        public int getAlignment()
      • setTypeToSelect

        public void setTypeToSelect​(boolean typeToSelect)