skip to main |
skip to sidebar
- A layout manager is an object that implements the LayoutManager interface and determines the size and position of the components within a container.
- Content pane defaults to BorderLayout
- JPanel layout defaults to FlowLayout
- A panel's layout manager can be set using the constructor
JPanel panel = new JPanel(new BorderLayout());
- Alternately it can be set using
panel.setLayout(new FlowLayout());
- Instead of using a layout absolute positioning can be used by setting the layout to null
- Arguments to add method depend on the layout manager. For example, BorderLayout requires to specify the area to which the component is to be added
No comments:
Post a Comment