Package totalcross.ui

Class ListBox.IconItem

  • Enclosing class:
    ListBox

    public static class ListBox.IconItem
    extends java.lang.Object
    Used to show an icon or two and a text. You can mix IconItem with other item types in the ListBox.
    Tip: The icons are automatically resized by default. If you don't want this, please set autoResizeIcon to false.
    Example:
     lb.add("this is a simple text");
     lb.add(new IconItem("this is a text with icon", iconImage));
     
    The icon should have the same size of the font's height, which can be set with:
     iconImage = originalImage.smoothScaledFixedAspectRatio(fmH, true, -1);
     
    Since:
    TotalCross 1.61
    • Constructor Summary

      Constructors 
      Constructor Description
      IconItem​(java.lang.String text, Image iconLeft)
      This receives the item text and left icon.
      IconItem​(java.lang.String text, Image iconLeft, Image iconRight)
      This receives the item text and the item left and right icons.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • text

        public java.lang.String text
      • icon

        public Image icon
        This is the icon of the item. It is highly recommended the size be 24DP.
      • iconRight

        public Image iconRight
        This is the icon of the item. It is highly recommended the size be 24DP.
      • marginBorder

        public static int marginBorder
    • Constructor Detail

      • IconItem

        public IconItem​(java.lang.String text,
                        Image iconLeft)
        This receives the item text and left icon. It is highly recommended the icon size be 24DP.
        Tip: The icons are automatically resized by default. If you don't want this, please set autoResizeIcon to false.
        Parameters:
        text - The item text.
        iconLeft - The left icon of the item.
      • IconItem

        public IconItem​(java.lang.String text,
                        Image iconLeft,
                        Image iconRight)
        This receives the item text and the item left and right icons. It is highly recommended the icons sizes be 24DP.
        Tip: The icons are automatically resized by default. If you don't want this, please set autoResizeIcon to false.
        Parameters:
        text - The item text.
        iconLeft - The left icon of the item.
        iconRight - The right icon of the item.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object