“This is the 24th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

BorderLayout layout

BorderLayout is also a simple layout strategy. If a container uses this layout, the container space is simply divided into five areas: East, west, South, north, and central, with the largest area in the middle. Each time you add a component, you should specify which region to add the component to. The region is represented by the static constants CENTER, NORTH, SOUTH.WEST, and EAST in BorderLayout, for example, A container CON with a BorderLayout layout can add a component B to the central region using the add method:

con.add(b,BorderLayout.CENTER);

Components added to an area occupy the entire area. You can place only one component per region, and if you place another component to an already placed region, the previous component will be replaced by the latter. A container with a BorderLayout layout can add up to five components. If you want to add more than five components to a container, you must use the container’s nesting or use another layout strategy.

The boundary layout manager divides the container’s layout into five locations: CENTER, EAST, WEST, NORTH, and SOUTH. The corresponding sequence is NORTH, SOUTH, WEST, EAST and CENTER, as shown in the figure below.

BorderLayout layout manager

1. The BorderLayout class is in the java.awt package

2. The default JFrame class layout is BorderLayout

The container is divided into five regions: East, West, South, North, and central, with the largest area in the middle

2. There are two ways to add a component:

The add (x, BorderLayout. Pos)

The add (BorderLayout. Pos, x)

• POS is one of NORTH, SOUTH, EAST, WEST,CENTER

BorderLayout layout

1. The east and west are different from the south and north

2. Instead of choosing a size that fits you, a component somewhere in the container takes up the entire area

3. The effect of repeatedly adding components in a location is that only the last component added is visible

4. If a component is missing in one location, components in other locations will occupy that location

Border layout manager

1.BorderLayout is the default layout manager for Windows, JFrame, and JDialog

2. The border layout manager divides the window into five regions: North, South, East, West, and Center

3.North means North, which will occupy the top of the panel. South, which means South, will occupy the bottom of the panel; East, for East, will occupy the right side of the panel; West, for West, will occupy the left side of the panel; The middle area Center is the area left after the east, south, west and north have been filled