How to use multiple Layout Managers in a single form?
27 Sep 2018 / 1 minute to read
It is very simple to use more than one Layout Manager in a single form.
- Drag-and-drop the FlowLayout Manager from the toolbox onto the form setting it as the Container control.
- Add Panels as Child controls onto the form. The FlowLayout Manager will automatically layout the Child components as shown below.
- Drag and drop the GridLayout Manager onto the Panel1 and add Button controls as Child controls. This will be arranged as follows.
- We can also make Panel2 as the Container control for GridBagLayout Manager. This will arrange it’s Child controls (Buttons) in a single row as shown below.
- Finally make Panel3 as the Container control for the BorderLayout Manager which will arrange the Child controls (Buttons) as follows.
- The final output of the application with all the Layout Managers arranged in the above said fashion is shown below.
Was this page helpful? Yes No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page