title: Swing GridBagLayout can't distribute(remove) empty spaces
body: <p>Even though I have read something about weighty I couldn't remove spaces given code fragment below:</p>
  
  <pre><code>    JPanel panel = new JPanel();
      scrollPane.setViewportView(panel);
      GridBagLayout gbl_panel = new GridBagLayout();
      GridBagConstraints gc = new GridBagConstraints ();
      gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0};
      gbl_panel.rowHeights = new int[]{0, 0};
      gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
      gbl_panel.rowWeights = new double[]{0.0, Double.MIN_VALUE};
      panel.setLayout(gbl_panel);
      for(int i = 0;i&lt;3;i++){
          gc.gridy = i;
          panel.add(new JButton("hi"),gc);
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/WgaNt.png" rel="nofollow noreferrer">That's what I get</a></p>
  
  <p><a href="https://i.stack.imgur.com/0zXVt.png" rel="nofollow noreferrer">That's what I want</a></p>
  
  <p>It distributes these 3 buttons with equal spaces(top,middle,bottom)
  If the components total size is bigger than panel's size(for example add 10 button) there is no problem.But if the total size of components smaller than panel's size it distributes all spaces.I want to set my components line by line(top to bottom withoud any spaces between components)
  Sorry for inconvenience thanks !</p>