// this is the basics of gui stuff import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; public class J05GameDisplay extends Component implements ActionListener { private ArrayList points; // this is called a constructor (look up the term) public J05GameDisplay() { points = new ArrayList(); points.add(new Point(5,5)); points.add(new Point(20,20)); } public static void main(String[] args) { J05GameDisplay j05 = new J05GameDisplay(); JButton myButton = new JButton("Press Me"); myButton.addActionListener(j05); JFrame jf = new JFrame(); jf.getContentPane().setLayout(new FlowLayout()); jf.getContentPane().add(j05); jf.getContentPane().add(myButton); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.pack(); jf.setVisible(true); } public void actionPerformed(ActionEvent e) { points.add(new Point((int)(Math.random()*400),(int)(Math.random()*400))); repaint(); } public Dimension getPreferredSize() { return new Dimension(400,400); } public void paint(Graphics g) { g.setColor(Color.BLACK); g.fillRect(0,0,400,400); for(int i=0;i