I have the following:
Widget, Widget ...
As I add children widgets to HorizontalPanel, it grows wider and finally adds a scroll bar since it becomes too wide.
I want it to start wrapping children once it reaches certain width, say 90% of the browser window.
My application generates widgets from external data.
I don't know in advance how many widgets will be in a row.
I want them placed in a row from left to right and then when reached the right edge of the window wrap into a new row.
Sorry, I was confused. It seems to work. There are a couple of issues here:
- widgets spill over the bottom when a lot are added, I want to have a vertical scrollbar instead of this
- how do I set the width of the flowpanel to about 90% of the screen?
Window#getClientWidth gives you the available width.
Based on this you can compute and use FlowPanel#setWidth()
Check out ScrollPanel. You can wrap your FlowPanel inside the ScrollPanel and then add the ScrollPanel to the parent container