title: Make 2 JButtons Equal in size
body: <p>I have two <code>JButton</code>s with texts "Ok" and "Cancel". I am using <code>GridBagLayout</code> to align them in a <code>JDialog</code>. I have set the anchor to <code>GridBagConstraints.CENTER</code>. Due to the difference in the number of characters in the texts "Ok" and "Cancel", the buttons are of different sizes. How do I align them correctly so that each of them have the same size. I tried the following but no avail.</p>
  
  <pre><code>okayButton.setSize(cancelButton.getSize());
  </code></pre>