title: Resize JButtons in a BoxLayout
body: <p>I'm trying to make a simple menu for my game. I have 4 buttons in the center and I want to make them a little bit bigger and center them.</p>
  
  <p>The last part worked but I can't seem to call any of my <code>JButtons</code> and do a <code>.setSize</code> / <code>.setPreferedSize(new Dimension())</code> on it.</p>
  
  <pre><code>public class mainMenu extends JFrame {
  private JButton start, highscore, help, stoppen;
  
  
  public mainMenu() {
      super("Master Mind");
      maakComponenten();
      maakLayout();
      toonFrame();
  }
  
  private void maakComponenten() {
      start = new JButton("Start");
      start.setBackground(Color.gray);
      highscore = new JButton("Higscores");
      help = new JButton("Help");
      stoppen = new JButton("Stoppen");
  }
  
  private void maakLayout() {
      JPanel hoofdmenu = new JPanel();
      hoofdmenu.setLayout(new BoxLayout(hoofdmenu, BoxLayout.Y_AXIS ));
      hoofdmenu.add(start);
      start.setAlignmentX(CENTER_ALIGNMENT);
      hoofdmenu.add(highscore);
      highscore.setAlignmentX(CENTER_ALIGNMENT);
      hoofdmenu.add(help);
      help.setAlignmentX(CENTER_ALIGNMENT);
      hoofdmenu.add(stoppen);
      stoppen.setAlignmentX(CENTER_ALIGNMENT);
      super.add(hoofdmenu);
  }
  
  private void toonFrame() {
      setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
      setVisible(true);
      setSize(500,500);
  
  }
  
  public static void main(String[] args) {
      new mainMenu();
  }
  }
  </code></pre>