import javax.swing.*;
import java.awt.event.*;

public class BunchOfButtons extends JFrame implements ActionListener {
    public BunchOfButtons() {
        super("Buttons!");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        JPanel buttonPanel = new JPanel();
        for(int i = 0; i < 10; ++i) {
            JButton button = new JButton("Button " + i);
            button.addActionListener(this);
            buttonPanel.add(button);
        }

        getContentPane().add(buttonPanel);
        pack();
    }

    public void actionPerformed (ActionEvent e) {
        System.out.println("Clicky!");
    }
        
    public static void main(String[] args) {
        new BunchOfButtons().setVisible(true);
    }
}