Java tutorial
//package com.java2s; /** * Copyright (c) 2010 Simon Denier * Released under the MIT License (see LICENSE file) */ import java.awt.GridBagConstraints; public class Main { public static GridBagConstraints gbConstr() { return compConstraint(GridBagConstraints.RELATIVE, GridBagConstraints.RELATIVE); } public static GridBagConstraints gbConstr(int gridy) { return compConstraint(GridBagConstraints.RELATIVE, gridy); } public static GridBagConstraints compConstraint(int gridx, int gridy) { return compConstraint(gridx, gridy, GridBagConstraints.LINE_START); } public static GridBagConstraints compConstraint(int gridx, int gridy, int anchor) { return compConstraint(gridx, gridy, GridBagConstraints.NONE, anchor); } public static GridBagConstraints compConstraint(int gridx, int gridy, int fill, int anchor) { GridBagConstraints constraints = new GridBagConstraints(); constraints.gridx = gridx; constraints.gridy = gridy; constraints.fill = fill; constraints.anchor = anchor; return constraints; } }