Java tutorial
//package com.java2s; /** * Copyright (c) 2010 Simon Denier * Released under the MIT License (see LICENSE file) */ import java.awt.Component; import java.awt.FlowLayout; import javax.swing.JPanel; public class Main { public static JPanel makeButtonBar(int align, Component... comps) { JPanel pan = new JPanel(new FlowLayout(align)); for (Component component : comps) { pan.add(component); } return pan; } }