So I've run into some troubles recently trying to create a custom grid widget. I want the ability to create an unknown amount of Rows (HLayouts). Each Row will have a fixed number of Labels. However, I get a stack overflow when I try to add too many rows. I've been able to reproduce this in a simple app. First I will show code that works:
Now, if I need to increase the rows to say 50, I get a stack overflow on line 2698
I think I'm setting this up correctly, but maybe I'm missing something? Should I increase the memory (current set at -Xmx600M)? I'm not sure what the work around would be, an html table maybe? Thanks.
Code:
private class RowDisplay extends VLayout {
public RowDisplay() {
RowDisplay.this.setWidth100();
RowDisplay.this.setHeight(20);
HLayout grid = new HLayout();
grid.setMembersMargin(1);
for (int i=0; i<31; i++) {
Label slot = new Label("Test " + Integer.toString(i+1));
grid.addMember(slot);
}
addMember(grid);
}
}
public void onModuleLoad() {
// create a grid of Labels
VLayout rows = new VLayout();
rows.setMembersMargin(1);
for (int i=0; i<10; i++) {
rows.addMember(new RowDisplay());
}
// add a VLayout Layer
VLayout layer_1 = new VLayout();
layer_1.setWidth100();
layer_1.setHeight100();
// add the row
layer_1.addMember(rows);
layer_1.draw();
}
Code:
for (int i=0; i<50; i++) {
rows.addMember(new RowDisplay());
}
Comment