I want to populate a scroll pane dynamically with a number of buttons. This is not working for me as I guess I am doing something wrong. I have a code snippet here
public static void load() {
final Screen screen = MyScreens.getScreen("/xml/testing.xml");
screen.setTitle("Buttons");
ScrollPane item = new ScrollPane();
for(int i = 0; i < 40; i++) {
Button b = new Button("Foo" + i);
item.add(b);
}
screen.add(item);
screen.setCurrent();
}
and testing.xml is defined thus
<screen style="layout:gridlayout(1, 6);" title="Intact: Menu">
<screenfirstmenu onAction="logout">Logout</screenfirstmenu>
</screen>
This shows the screen with the title buttons, but no button will show.

