Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.GridBagConstraints;
import java.awt.Insets;

public class Main {
    public static GridBagConstraints createConstraints(int gridx, int gridy, int gridwidth, int gridheight,
            int anchor, int fill, Insets insets) {
        GridBagConstraints c = new GridBagConstraints();
        c.gridx = gridx;
        c.gridy = gridy;
        c.gridwidth = gridwidth;
        c.gridheight = gridheight;
        c.weightx = 0.5;
        c.weighty = 0.5;
        c.anchor = anchor;
        c.fill = fill;
        c.insets = insets;
        return c;
    }

    public static GridBagConstraints createConstraints(int gridx, int gridy, int gridwidth, int gridheight) {
        return createConstraints(gridx, gridy, gridwidth, gridheight, GridBagConstraints.WEST,
                GridBagConstraints.NONE, new Insets(5, 0, 0, 0));
    }

    public static GridBagConstraints createConstraints(int gridx, int gridy, int gridwidth, int gridheight,
            Insets insets) {
        return createConstraints(gridx, gridy, gridwidth, gridheight, GridBagConstraints.WEST,
                GridBagConstraints.NONE, insets);
    }
}