title: Centering JButtons in a JFrame - Java
body: <p>I want to manually center multiple <code>JButton</code> in a <code>JPanel</code> but my pixel count does not add up. It looks like the right side space is smaller then the left. How do I center them properly?</p>
  <pre><code>JFrame f = new JFrame(&quot;Checkers&quot;);
  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  f.setSize(400, 400);
  f.setVisible(true);
  JButton onePlayer=new JButton(&quot;1 Player&quot;);
  onePlayer.setBounds(100, 100, 200, 30);
  add(onePlayer);
  onePlayer.setVisible(true);
  setLayout(null);
  </code></pre>