(Jpanel) a panel is a lightweight container. Because it is not a top-level container, it must be placed on advanced containers such as jframe, so that you can) the complex application interface is built through panel and five interface layout managers.
The following describes five interface layout managers:
Borderlayout:
This is a border layout for container layout. It can arrange container components and adjust their size to meet the following five areas: north, south, east, west, and middle. Each region can contain up to one component and is identified by corresponding constants:NORTH,SOUTH,EAST,WEST,CENTER. When adding a component to a container using the border layout, use one of the five constants, for example:
Panel p = new Panel(); p.setLayout(new BorderLayout()); p.add(new Button("Okay"), BorderLayout.SOUTH);FLowLayout:
The stream layout is used to arrange components in a directed stream, which is very similar to text lines in a section. The direction of the stream depends on the container'scomponentOrientationAttribute,
It may be one of the following two values:
ComponentOrientation.LEFT_TO_RIGHT
ComponentOrientation.RIGHT_TO_LEFT
Streaming layout is generally used to arrange buttons in the panel. It places buttons horizontally until there is no suitable button on the same line.
GirdLayout:
The gridlayout class is a layout processor that arranges container components in the form of rectangular grids. Containers are divided into rectangles of the same size,
Place a component in a rectangle.
BoxLayout:
Allows vertical or horizontal layout of layout managers for multiple components. These components will not be packaged, so for example, vertically arranged components are still vertically arranged when the frame is adjusted.
Nesting multiple panels using different combinations of horizontal and vertical components is similar to gridbaglayout, but not that complex. The figure shows two horizontally arranged panels, each of which contains three vertically arranged widgets.
Cardlayout:
Similar to the concept of layers, you can use cardlayout on a form or panel to take the customized UI as a layer, so that when there are multiple layers, you can switch between layers.
Similar to a flop.