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

public class GraphicsEngine extends JPanel{
    private final int SIZEX=500;
    private final int SIZEY=500;
    private GraphicsObject[] objectList;
    
    public GraphicsEngine(GraphicsObject[] inList) {
        setPreferredSize(new Dimension(SIZEX,SIZEY));
        JFrame theFrame = new JFrame();
        theFrame.addWindowListener(
            new WindowAdapter(){ 
                public void windowClosing(WindowEvent event)
                    {System.exit(0);} 
                }
            );
        objectList = inList;    
        theFrame.setContentPane(this);
        theFrame.pack();
        theFrame.setVisible(true);
    }

    protected void paintComponent(Graphics g)
    {
        for (int i=0;i<objectList.length;i++){
            objectList[i].paint(g);
        }
    }
}