import javax.swing.*;
import javax.swing.Timer;
import java.util.*;
import java.awt.event.*;
import java.awt.*;
public class MoleGUI implements ActionListener{
JFrame field;
JPanel panel;
JButton h1,h2,h3,h4,h5,h6,h7,h8,h9;
Timer t = new Timer(5, this);
int counter;
ArrayList<JButton> holes;
public MoleGUI() {
field = new JFrame("Whack-a-Mole");
panel = new JPanel(new GridLayout(3,3));
field.setContentPane(panel);
field.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
holes = new ArrayList<JButton>();
holes.add(h1 = new JButton());
holes.add(h2 = new JButton());
holes.add(h3 = new JButton());
holes.add(h4 = new JButton());
holes.add(h5 = new JButton());
holes.add(h6 = new JButton());
holes.add(h7 = new JButton());
holes.add(h8 = new JButton());
holes.add(h9 = new JButton());
panel.add(holes.get(1));
panel.add(holes.get(2));
panel.add(holes.get(3));
panel.add(holes.get(4));
panel.add(holes.get(5));
panel.add(holes.get(6));
panel.add(holes.get(7));
panel.add(holes.get(8));
panel.add(holes.get(9));
holes.get(1).addActionListener(this);
holes.get(2).addActionListener(this);
holes.get(3).addActionListener(this);
holes.get(4).addActionListener(this);
holes.get(5).addActionListener(this);
holes.get(6).addActionListener(this);
holes.get(7).addActionListener(this);
holes.get(8).addActionListener(this);
holes.get(9).addActionListener(this);
//counter = 0;
//t.start();
}
public void display(){
field.pack();
field.setVisible(true);
field.resize(500,500);
//run();
}
public void run()
{
}
public void actionPerformed(ActionEvent e)
{
}
}