title: Java Swing buttons to make them equal
body: <pre><code>import javax.swing.*;
  import java.awt.*;
  
  public class MathsTutorProgram
  {
      public static void main(String[]args)
      {
          JFrame a = new JFrame(); //Create a blank window
          JPanel panel = new JPanel(); //Create a panel
  
          //Buttons
          JLabel welcome = new JLabel("Welome to Maths Tutor!");
          JButton lessThan = new JButton ("&lt;");
          JButton greaterThan = new JButton ("&gt;");
          JButton equals = new JButton ("=");
          JButton askMe = new JButton ("Ask me a question!");
  
          //panels
          panel.add(welcome);
          panel.add(lessThan);
          panel.add(greaterThan);
          panel.add(equals);
          panel.add(askMe);
          a.setContentPane(panel); //Use panel on Window
  
          //sets
          a.setTitle("Maths Tutor Program"); //Change window title
          a.setSize(300,200); //Change window size
          a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          a.setVisible(true);
  
          //Border layout + Location
          BorderLayout layout = new BorderLayout();
          panel.setLayout(layout);
  
          panel.add("North", welcome);
          panel.add("East", equals);
          panel.add("South", askMe);
          panel.add("West", lessThan);
          panel.add("Center", greaterThan);
      }
  }
  </code></pre>
  
  <p>I have working java swing. My &lt;, > and = buttons are not the same size.<br>
  Centre button '=' is bigger than East '>' button and West button '&lt;'.
  Do I have to use gridlayout or can I still make three middle buttons same size using boarderlayout?<br>
  How can I make these three buttons same size regardless of the window size?  </p>
  
  <p><strong>Update</strong>  </p>
  
  <pre><code>//Border layout + Location
      BorderLayout layout = new BorderLayout();
      panel.setLayout(layout);
      panel.add("North", welcome);
      panel.add("South", askMe);
  
      JPanel buttonPanel = new JPanel(new GridLayout(1,3));
      buttonPanel.add(lessThan);
      buttonPanel.add(equals);
      buttonPanel.add(greaterThan);
      panel.add(buttonPanel); 
  </code></pre>
  
  <p>Fixed the code.<br>
  East, west and centre buttons (&lt;, >, and =) are averaged to same size regardless of the window size. </p>