create Vertical Box - Java Swing

Java examples for Swing:BoxLayout

Description

create Vertical Box

Demo Code


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

import java.awt.*;

public class Main {
    public static Box createVertBox(Component... comps) {
        return createBox(BoxLayout.PAGE_AXIS, comps);
    }//from  w  ww.  j a  v  a2  s  .c o 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