Custom creation method for GridBagConstraints . - Java Swing

Java examples for Swing:GridBagLayout

Description

Custom creation method for GridBagConstraints .

Demo Code


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

public class Main {
    /**/*from  w  ww .  j  a  v  a 2 s  .  c  o  m*/
     * Custom creation method for {@link GridBagConstraints}.
     */
    public static GridBagConstraints createCustomGBC(final int x,
            final int y, final double weightx, final int fill) {
        final GridBagConstraints gbc = createCustomGBC(x, y);
        gbc.weightx = weightx;
        gbc.fill = fill;
        return gbc;
    }

    /**
     * Custom creation method for {@link GridBagConstraints}.
     */
    public static GridBagConstraints createCustomGBC(final int x,
            final int y) {
        final GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = x;
        gbc.gridy = y;
        return gbc;
    }
}

Related Tutorials