title: Changing size of Java button GridBayLayout
body: <p>Hello I have a big problem. I would like to make "=" button 2*height and the "0" button 2*width(OTHER buttons should be just normal size), that's all I tried many combinantions, but instead i get weird sizes.</p>
  
  <p>O i get that</p>
  
  <p><a href="http://desmond.imageshack.us/Himg684/scaled.php?server=684&amp;filename=33109545.jpg&amp;res=landing" rel="nofollow noreferrer">what i get http://desmond.imageshack.us/Himg684/scaled.php?server=684&amp;filename=33109545.jpg&amp;res=landing</a></p>
  
  <p>I would like to get sth similar to that I found in web(only button layout)</p>
  
  <p><img src="https://i.stack.imgur.com/JzPzG.png" alt="enter image description here"></p>
  
  <pre><code>public void someMethod()
      Container cp = getContentPane();
      cp.setLayout(new BorderLayout());
      JPanel wyswietlacz = new JPanel();
      JTextField txt = new JTextField("123");
      txt.setPreferredSize(new Dimension(getWidth() - 10, 35));
      txt.setAlignmentX(JTextField.RIGHT_ALIGNMENT);
      wyswietlacz.add(txt);
      JPanel opcje = new JPanel();
      String[] etykiety = { "C", ".", "/", "*", "7", "8", "9", "-", "4", "5",
              "6", "+", "1", "2", "3", "=", "0", "+/-" };
  
      JButton[] przyciski = new JButton[18];
      for (int i = 0; i &lt; przyciski.length; i++)
          przyciski[i] = new JButton(etykiety[i]);
  
      GridBagLayout gridbag = new GridBagLayout();
      GridBagConstraints c = new GridBagConstraints();
      c.fill = GridBagConstraints.BOTH;
      opcje.setLayout(gridbag);
      for (int i = 0; i &lt; przyciski.length; i++) {
          if (((i + 1) % 4) == 0) {
  
              c.gridwidth = GridBagConstraints.REMAINDER;
          } else {
              c.gridwidth = GridBagConstraints.RELATIVE;
  
          }
  
          if (i == 15) {
              c.gridheight = 2;
  
              c.fill = GridBagConstraints.HORIZONTAL;
          }
          if (i == 16)
              c.gridy = GridBagConstraints.SOUTH;
  
          if (i == 16) {
              c.gridwidth = 2;
              c.fill = GridBagConstraints.HORIZONTAL;
          }
  
          makebutton(przyciski[i], gridbag, c, opcje);
      }
  
      add(wyswietlacz, BorderLayout.NORTH);
      add(opcje, BorderLayout.CENTER);
  
  }
  
  protected void makebutton(JButton button, GridBagLayout gridbag,
          GridBagConstraints c, JPanel jp) {
      gridbag.setConstraints(button, c);
      jp.add(button);
  }
  
  public static void main(String[] args) {
      new Kalkulator();
  }
  </code></pre>