Problem in Java GUI

Before reading about my problem, first look at the GUI Graph .

At the top there are three bars:

  • with buttons "visual representation", "text representation", etc.
  • the second with the buttons "processes", "organization", etc.
  • the third with buttons "application to processes", etc.

After that, there are two information lines.

After that, a canvas window will appear displaying the chart.

Now I want the GUI to look like it with the following functions (relative to the diagram above):

  • At first, only the first column appears, and below it appears a white empty bar without a diagram spreading throughout the graphical interface.

  • When the user presses the “fine-looking” button, a second bar appears below the first bar, and after that the same canvas without a chart extends to the remaining space

  • When the user presses the “application” button on the second bar, the third bar appears under the second bar, after which the same empty canvas spreads out through the remaing space in the graphical interface.

I tried to implement it by first having a "main panel" with BorderLayout. After that, as shown in the following figure:

mainPanel(Border Layout)
|
|--topPanel (at NORTH of the mainPanel Border Layout)
|
|
|--centerPanel (at CENTER of the mainPanel Border Layout)

topPanel - contain all bars (bars should be added dynamically when the user clicks a button)

centerPanel - contain the canvas and automatically adjust its size when adding new bars to topPanel

0
2

BorderLayout , .

BoxLayout 3 3 . .

, , , . , add()/remove() .

+2

- MigLayout, , "". "hidemode", , .

MigLayout

0

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


All Articles