Here you can find the source of setGBLayout(JPanel panel, int[] columnWidths, int[] rowHeights, double[] columnWeights, double[] rowWeights)
public static GridBagLayout setGBLayout(JPanel panel, int[] columnWidths, int[] rowHeights, double[] columnWeights, double[] rowWeights)
//package com.java2s; //License from project: Open Source License import java.awt.GridBagLayout; import javax.swing.JPanel; public class Main { public static GridBagLayout setGBLayout(JPanel panel, int[] columnWidths, int[] rowHeights, double[] columnWeights, double[] rowWeights) { GridBagLayout gbl = new GridBagLayout(); gbl.columnWidths = columnWidths; gbl.rowHeights = rowHeights;//from ww w . j a v a 2 s .c om gbl.columnWeights = columnWeights; gbl.rowWeights = rowWeights; panel.setLayout(gbl); return gbl; } }