In Panel, the default layout is a FlowLayout where components are centered horizontally, so, a programmer can automatically arrange the components with the same sizes. On the other hand, contentPanes have BorderLayout as their default layout where regions are used to hold components and/or containers.
In Java, the following are the layout managers:
BorderLayout - makes use of regions - NORTH, SOUTH, WEST, EAST, CENTER;
- FlowLayout - moves the components left to right and automatically wraps components;
- GridLayout - use this if you want to see components in rows and in columns where components are of the same size;
- CardLayout - this layout manager allows you to see only one component at a time;
- BoxLayout - this layout allows you to see components in a row or in a column;
- GridBagLayout - allows the control of size, placement and alignment constraints of each component.