title: How can i use multiple panels with different layouts for my gui?
body: <p>i have problems with nesting 2 different button panels into my main panel. It worked for me with only one 1 panel. Now with my actual nesting i see the last added panel over my main panel and my first button panel. Additionally the &quot;editButton&quot; i added, is not showing up. I got no errors while compiling. It seems to be that i just made a mistake in the arrangement.
  Would be very nice if there are any suggestions. Here is my code snippet:
  Thanks in advance!</p>
  <pre><code>private final String name;
  private JLabel catLabel;
  private JButton cat1Button;
  private JButton cat2Button;
  private JButton cat3Button;
  private JButton cat4Button;
  private JButton editButton;
  private JButton deleteButton;
  private JButton insertButton;
  
  public JPanel panelMain;
  public JPanel panel;
  public JPanel panel1;
  
  
  public ReadwriteQuiz readwrite;
  
  public GUIEdit(String name){
  
      this.name = name;
      this.setTitle(name);
  
      this.setLocationRelativeTo(null);
      this.setLayout((null));
      this.setSize(400,300);
      this.setLocation(400,150);
      this.setResizable(false);
  
      panelMain = new JPanel();
      panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS));
  
      panel = new JPanel();
      panel.setLayout(new FlowLayout());
      panel.setBackground(Color.lightGray);
  
      panel1 = new JPanel();
      panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
      panel1.setBackground(Color.ORANGE);
  
      panelMain.add(panel);
      panelMain.add(panel1);
  
      catLabel= new JLabel(&quot;Willkommen zum Quizzeln ! \n Wählen Sie Ihre Kategorie&quot;);
      catLabel.setBounds(90,10,260,40);
      panel.add(catLabel);
  
      cat1Button = new JButton(&quot;Kategorie 1&quot;);
      cat1Button.setBounds(52,90,120,40);
      panel.add(cat1Button);
      cat1Button.addActionListener((e) -&gt; {
          try {
              readwrite.readFile(&quot;kategorie1.txt&quot;);
          } catch (FileNotFoundException fileNotFoundException) {
              fileNotFoundException.printStackTrace();
          }
      });
  
      cat2Button = new JButton(&quot;Kategorie 2&quot;);
      cat2Button.setBounds(220,90,120,40);
      panel.add(cat2Button);
  
      cat3Button = new JButton(&quot;Kategorie 3&quot;);
      cat3Button.setBounds(52,160,120,40);
      panel.add(cat3Button);
  
      cat4Button = new JButton(&quot;Kategorie 4&quot;);
      cat4Button.setBounds(220,160,120,40);
      panel.add(cat4Button);
  
      editButton = new JButton(&quot;Frage editieren&quot;);
      editButton.setBounds(52,400,120,40);
      panel1.add(editButton);
  
      this.add(panelMain);
      this.add(panel);
      this.add(panel1);
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  
  @Override
  public void actionPerformed(ActionEvent e) {
  
  }
  </code></pre>