create Horizontal Box - Java Swing

Java examples for Swing:BoxLayout

Description

create Horizontal Box

Demo Code


//package com.java2s;
import javax.swing.*;

import java.awt.*;

public class Main {
    public static Box createHorizBox(Component... comps) {
        return createBox(BoxLayout.LINE_AXIS, comps);
    }/*  w  w w.  j  a  v a  2 s  .  co m*/

    public static Box createBox(int axis, Component... comps) {
        Box r = new Box(axis);
        for (Component comp : comps) {
            r.add(comp);
        }
        return r;
    }
}

Related Tutorials