Can a layout manager create multiple JPanels?

I need to create a fairly large form with many controls. The controls are divided into basic controls / settings and advanced controls / settings. The user can decide whether he wants to see only the basic or both basic and advanced controls.

I reset all advanced controls to my own JPanel so that I can easily switch between the two views by showing or hiding this panel.

I am currently using GroupLayout, and what happens is that the controls on the different panels are not aligned:

Label aaa:     Text field
Label a:       Text field
Label aaaaaa:  Text field
----------------------------
Label b:    Text field
Label bbb:  Text field
Label bb:   Text field

Unfortunately, now I have found a way to “synchronize” the layouts of two panels (except for using AbsoluteLayout and fixed control coordinates)

  • ?
  • ?

: , GroupLayout.

+3
6

, Swing LayoutManager ( JRE ) .

( " " ) DesignGridLayout, , ( 2 , , - , ;))

, , - ( GroupLayout) / . , GroupLayout ( ()).

GroupLayout , , , (), / .

, .

+2

, () - . . .

- . , , . .

+1

, . , , , , GroupLayout.

+1

GridLayout GroupLayout,

0

:

. , , .

0

Source: https://habr.com/ru/post/1702406/


All Articles