//draw an image test driver
//modified from computer insights Arnold UTM
//mbooth 2005 12

//import section
import javax.swing.*;//gui
import java.awt.*; //events
import java.awt.image.*; //events to load image

//draws image on panel
class DrawingImagePanel extends JPanel
{
    //fields
	private BufferedImage b;//holds image
	private int i;//counter

    //constructor sets up panel
	public DrawingImagePanel()
    {
        //variables
        Dimension dim;//set size based on image
		setBackground(Color.black);
		b=ImageLoader.loadImage("desk.jpg");//load image using ImageLoader class

		//determine dimension and set size based on image
		dim = new Dimension(b.getWidth(), b.getHeight());
		setPreferredSize(dim);
	}//end of constructor

	//overridden method of JPanel,
	// to paint onto panel
	public void paintComponent(Graphics g)
    {
		super.paintComponent(g);//override JPanel
        g.drawImage(b,0,0,null);//draw image
		g.setColor(Color.white);//set colour of "pen"
		g.drawString("i="+i,10,10);//put counter for testing
        g.fillOval(100+i,100+i, 10, 10);//fill oval
		i++; //add to counter
	}//end of paintComponent
}//end of class