title: Java GUI - How to center a single button
body: <p>I'm very new to java (I'm used to python).</p>
  
  <p><strong>NOTE: I do want the position to stay in the center even when the gui is resized.</strong></p>
  
  <p>I was wondering how I can center a single button? At the moment, the button is at the top of the gui.</p>
  
  <pre><code>public class main_gui extends JFrame{
  
      public static void main(String[] args) {
  
          // Initial window
          JFrame start_frame = new JFrame("P.D");
          start_frame.setSize(1200, 800);
          start_frame.setVisible(true);
          start_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          // Panel to hold our buttons
          JPanel start_panel = new JPanel();
          start_frame.add(start_panel);
  
  
          // Button to initialize everything
          JButton start_button = new JButton("Start");
          // Take out the border around the text
          start_button.setFocusable(false);
          start_panel.add(start_button);
      }
  }
  </code></pre>
  
  <p><strong>Here is what is currently looks like, I just want this button down a bit, to the center.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/NoVI7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NoVI7.jpg" alt="enter image description here"></a></p>