The problem may be that the flextable is set to be too wide initially. It will fill the scrollpanel by default, and then as a result the columns will stretch to their maximum width.
You should set the width of the flextable explicitly in the beginning, and it will automatically resize correctly when more columns are added at run time.
Here is an example for when you have initially one row and two 100px columns:
ft = new FlexTable();
ft.addStyleName("flextable");
ft.setWidth("200px");
for (int x = 0; x < 2; x++) {
ft.setText(x, 0, "cell");
ft.getCellFormatter().addStyleName(x, 0, "testcell");
}
scrollpanel.add(ft);
and your css should say this:
.flextable {
table-layout: fixed;
}
.testcell {
width : 100px;
}
Note that the flextable is initially set to 200px width, as we start with two columns.
In the CSS file, the table-layout attribute must be set otherwise the columns will get smaller than 100px as you add more (until the cells reach their minimum width, defined by their content).
Also, remember to add the stylename "testcell" to any new cells that you add at runtime.