Java Swing GridLayout layoutEvenHorizontal(JComponent... list)

Here you can find the source of layoutEvenHorizontal(JComponent... list)

Description

Layout components in evenly split horizontal boxes

License

BSD License

Declaration

public static JComponent layoutEvenHorizontal(JComponent... list) 

Method Source Code

//package com.java2s;
/***/* w w  w .  j a  v a2 s.  c o m*/
 * Copyright (C) 2010 Johan Henriksson
 * This code is under the Endrov / BSD license. See www.endrov.net
 * for the full text and how to cite.
 */

import java.awt.GridLayout;

import javax.swing.*;

public class Main {
    /**
     * Layout components in evenly split horizontal boxes
     */
    public static JComponent layoutEvenHorizontal(JComponent... list) {
        JPanel p = new JPanel(new GridLayout(1, list.length));
        for (JComponent c : list)
            p.add(c);
        return p;
    }
}

Related

  1. gridLayout(JComponent c, int rows, int cols, int gap, boolean n, boolean s, boolean w, boolean e)