Reputation: 1654
I want to create table and add a widgets to the table.
My requirement to add widgets in the table with exactly three column and the number of widgets is dynamic
For example,
MyGrid myGrid = new MyGrid( 3 ); // Three Columns
//first row
myGrid.add( new Label("row1 column1"));
myGrid.add( new Label("row1 column2"));
myGrid.add( new Label("row1 column3"));
// second row
myGrid.add( new Label("row2 column1"));
myGrid.add( new Label("row2 column2"));
How can i achieve this without using any index calculation in my code?
Upvotes: 0
Views: 326
Reputation: 131
I would use a FlowPanel and do the style with css for the case with a static column count.
If the column size should be set dynamically then it a bit more tricky with a flow panel, but with some width calculation it should be possible as well.
Upvotes: 0