Here you can find the source of newButton(String text, ActionListener... listeners)
static Component newButton(String text, ActionListener... listeners)
//package com.java2s; //License from project: Open Source License import java.awt.Component; import java.awt.event.ActionListener; import javax.swing.JButton; public class Main { static Component newButton(String text, ActionListener... listeners) { return newButton(text, null, listeners); }/* w w w. jav a 2s. com*/ static Component newButton(String text, String actionCommand, ActionListener... listeners) { JButton button = new JButton(text); button.setActionCommand(actionCommand); for (ActionListener l : listeners) button.addActionListener(l); return button; } }