create Grid Bag Constraints - Java Swing

Java examples for Swing:GridBagLayout

Description

create Grid Bag Constraints

Demo Code


//package com.java2s;
import java.awt.*;

public class Main {
    public static final int DEFAULT_INSET = 1;

    public static GridBagConstraints createGridBagConstraints(int gridx,
            int gridy, int leftInset, int rightInset) {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;
        gbc.gridx = gridx;/*  w ww.  j  ava  2 s  . c o m*/
        gbc.gridy = gridy;

        gbc.insets = new Insets(DEFAULT_INSET, leftInset, DEFAULT_INSET,
                rightInset);

        return gbc;
    }
}

Related Tutorials