Java tutorial
//package com.java2s; //License from project: Open Source License import java.awt.Component; import java.awt.Container; import java.awt.GridBagConstraints; public class Main { /** * Helper method that taked a component and adds it to a container using * {@link java.awt.GridBagConstraints}. * @param container The container to add to. * @param component The componend to be added. * @param gridx GridBagConstraints value. * @param gridy GridBagConstraints value. * @param fill GridBagConstraints value. */ public static void addWithLesserGridBagConstraints(final Container container, final Component component, final int gridx, final int gridy, final int fill) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = gridx; gridBagConstraints.gridy = gridy; gridBagConstraints.fill = fill; container.add(component, gridBagConstraints); } }