List of usage examples for java.awt GridBagLayout getLayoutWeights
public double[][] getLayoutWeights()
From source file:Main.java
public static void main(String[] argv) throws Exception { JFrame frame = new JFrame(); GridBagLayout gbl = new GridBagLayout(); frame.setLayout(gbl);/*from w w w.j a v a2s.c om*/ frame.add(new JButton("1")); frame.add(new JButton("2")); gbl.layoutContainer(frame); double[][] weights = gbl.getLayoutWeights(); for (int i = 0; i < 2; i++) { for (int j = 0; j < weights[i].length; j++) { weights[i][j] = 1; } } gbl.columnWeights = weights[0]; gbl.rowWeights = weights[1]; frame.pack(); frame.setVisible(true); }