Here you can find the source of makeButtonPanel(Vector
public final static JPanel makeButtonPanel(Vector<String> names, ActionListener actionListener)
//package com.java2s; //License from project: Open Source License import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.JButton; import javax.swing.JPanel; public class Main { public final static JPanel makeButtonPanel(Vector<String> names, ActionListener actionListener) { JPanel pane = new JPanel(); for (String s : names) { JButton b = makeButton(s, actionListener); pane.add(b);//w w w .j a v a 2s . co m } return pane; } /** * Return a button with action command set to name. * * @param name * @param l * @return */ public final static JButton makeButton(String name, ActionListener l) { JButton button = new JButton(name); button.addActionListener(l); button.setActionCommand(name); return button; } }