Hey Ranchar i would like to know one thing that as we know that flow lay out arrange component from left to right and work as word wrapping feature of ms word well but i want by flow lay out that after adding two component next component should be added on the next line how can i accomplise that ?
ok, nothing is impossible and there are some creative ways (read: "hacks") I can think of that might force FlowLayout to do something like this. But the easiest way to achieve the effect you want is to have two nested Containers within your Container. It would look something like this:
i want by flow lay out that after adding two component next component should be added on the next line
That is not the way FlowLayout is designed to work. You need to use a different layout manager or combination of layout managers:
1. You could use a GridLayout. For example. GridLayout layout = new GridLayout(0, 2); This will wrap components to a new line after 2 columns have been filled. However, all components will be the same size.
2. You could use a GridBagLayout. In this case you need to specify the row/column of each component you add so you manually create your grid.
3. You could use a vertical BoxLayout. Then you create child panels to add to the layout. Each child panel can contain a panel using a FlowLayout with two components.