Package totalcross.ui

Class ListContainer.Item

  • Enclosing class:
    ListContainer

    public static class ListContainer.Item
    extends Container
    An item of the ListContainer.
    • Field Detail

      • leftControl

        public java.lang.Object leftControl
        The left and/or right controls that will be displayed.
      • rightControl

        public java.lang.Object rightControl
        The left and/or right controls that will be displayed.
      • items

        public java.lang.String[] items
        The Strings that will be displayed in the container. Individual items cannot be null; pass "" instead to not display it.
      • leftControlVisible

        public boolean leftControlVisible
        When leftControl or rightControl is an Image, set this to false to don't show it (and also disable controls)
      • rightControlVisible

        public boolean rightControlVisible
        When leftControl or rightControl is an Image, set this to false to don't show it (and also disable controls)
    • Constructor Detail

      • Item

        public Item​(ListContainer.Layout layout)
        Constructs an Item based in the given layout. You must set the items array with the strings that will be displayed. You may also set the leftControl/rightControl and individual itemColors and boldItems.
    • Method Detail

      • initUI

        public void initUI()
        Description copied from class: Container
        Called to initialize the User Interface of this container. This differs from the onAddAgain method by that this method is called only once, at the first time the control is added to the parent. When the container is being setup, the initUI method is called; then, the onAddAgain is called every time the container is added again.
        Overrides:
        initUI in class Container
      • onEvent

        public void onEvent​(Event e)
        Description copied from class: Control
        Called to process key, pen, control and other posted events.
        Overrides:
        onEvent in class Control
        Parameters:
        e - the event to process
        See Also:
        Event, KeyEvent, PenEvent
      • setImage

        public void setImage​(boolean isLeft,
                             boolean toImage1)
      • postListContainerEvent

        public void postListContainerEvent​(java.lang.Object target,
                                           java.lang.Object source,
                                           int type,
                                           boolean is2)
      • getPreferredWidth

        public int getPreferredWidth()
        Description copied from class: Control
        Returns the preferred width of this control.
        Overrides:
        getPreferredWidth in class Control
      • getPreferredHeight

        public int getPreferredHeight()
        Description copied from class: Control
        Returns the preferred height of this control.
        Overrides:
        getPreferredHeight in class Control
      • getLeftControlX

        public int getLeftControlX()
      • getRightControlX

        public int getRightControlX()
      • onPaint

        public void onPaint​(Graphics g)
        Description copied from class: Container
        Draws the border (if any). If you override this method, be sure to call super.onPaint(g);, or the border will not be drawn.
        Overrides:
        onPaint in class Container
        Parameters:
        g - the graphics object for drawing
        See Also:
        Graphics