List from Code and Renderer from Gui

58 views
Skip to first unread message

Hùng Phạm

unread,
Sep 11, 2014, 11:02:53 PM9/11/14
to codenameone...@googlegroups.com
Dears.
I made a list with custom design. The list was made from code (not in Gui Builder). 
I can customize it with using ListCellRenderer and make my own items as Container. So it's no problem with ListCellRenderer.
I wonder can we use the Renderer made from Gui Buidler to List made from code? How can i do it?
For example:
MyView.java
...
        lst = new List((Vector) items);
        lst.setOrientation(List.HORIZONTAL);
        lst.setFixedSelection(List.FIXED_CENTER);
        lst.addSelectionListener(selectListener);
        bubbleParent.addComponent(lst);

TypeRenderer from GUI Buidler

Thanks.

Shai Almog

unread,
Sep 12, 2014, 4:46:03 AM9/12/14
to codenameone...@googlegroups.com
Hi,
you can use GenericListCellRenderer which is what the GUI builder uses internally.
Use createContainer twice to create your renderer container instances (notice the plural, do not use the same instance!) and submit them to the generic list cell renderer constructor.
Reply all
Reply to author
Forward
0 new messages