title: How can I place buttons in the center of the frame in a vertical line?
body: <p>I will place these buttons in the center of the frame and above each other, like this. </p>
  
  <pre><code>                                     BUTTON
                                       BUTTON
                                       BUTTON
  </code></pre>
  
  <p>I've searched multiple topics on this forum but everything I tried didn't work for so far. I hope that somebody has the solution. </p>
  
  <p>This is my code for so far:</p>
  
  <pre><code>package ípsen1;
  
  import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.Toolkit;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  
  import javax.swing.JButton;
  import javax.swing.JPanel;
  
  public class Paneel extends JPanel implements ActionListener {
  Image achtergrond;
  private JButton spelHervatten;
  private JButton spelOpslaan;
  private JButton spelAfsluiten;
  
  
  public Paneel(){
      //buttons   
      spelHervatten = new JButton("Spel hervatten");
      spelHervatten.setPreferredSize(new Dimension(380, 65));
  
      spelOpslaan = new JButton("Spel opslaan");
      spelOpslaan.setPreferredSize(new Dimension(380, 65));
  
      spelAfsluiten = new JButton("Spel afsluiten");  
      spelAfsluiten.setPreferredSize(new Dimension(380, 65));
  
  
      //object Paneel luistert naar button events
      spelAfsluiten.addActionListener(this);
  
      add (spelHervatten);
      add (spelOpslaan);
      add (spelAfsluiten);
      }
  
  public void paintComponent(Graphics g) {
      //achtergrond afbeelding zetten
      achtergrond = Toolkit.getDefaultToolkit().getImage("hout.jpg");
      //screensize
      g.drawImage(achtergrond, 0,0, 1024,768,this);
  }
  
      //actie na klik op button
              public void actionPerformed(ActionEvent e) {
                  if(e.getSource() == spelAfsluiten){
                      System.out.println("Spel afsluiten");
                      System.exit(0);
                      }
                  }
              }
  </code></pre>