Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.awt.Component;
import java.awt.Container;
import java.awt.GridBagConstraints;
import java.awt.Insets;

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 weightx GridBagConstraints value.
     * @param weighty GridBagConstraints value.
     * @param fill GridBagConstraints value.
     * @param insets GridBagConstraints value.
     */
    public static void addWithGridBagConstraints(final Container container, final Component component,
            final int gridx, final int gridy, final double weightx, final double weighty, final int fill,
            final Insets insets) {
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = gridx;
        gridBagConstraints.gridy = gridy;
        gridBagConstraints.weightx = weightx;
        gridBagConstraints.weighty = weighty;
        gridBagConstraints.fill = fill;
        gridBagConstraints.insets = insets;
        container.add(component, gridBagConstraints);
    }
}