package breakout;//all information for BreakOut in one file

import java.awt.event.*;
import java.awt.*;
import cs101.io.*;				// Necessary  import statements
import cs101.awt.*;
import cs101.net.*;
import java.lang.*;
import java.util.Vector;
import java.io.*;
import java.awt.image.ImageObserver;

//class which creates Image on the Canvas. Has all of the methods from canvas
public class ImageCanvas extends Canvas 
{
	//necessary fields to import the GIF image
	public Toolkit tk;    
    public Image myImage;  
    public Image myImage1;
	
	
	//constructor which imports the images. sets the properties for the frame (size and location), as well.	
	public ImageCanvas()
	{
		tk= Toolkit.getDefaultToolkit();
		myImage= tk.getImage("j:\\pg\\Breakout\\breakout\\Image\\spotting.gif");
		myImage1=tk.getImage("j:\\pg\\Breakout\\breakout\\Image\\bl00381_.gif");
		System.out.println("HHHHHHHHHHHHHHHHHHH: " + this.myImage.getHeight(this)); 
		
		while (this.myImage.getHeight(this) == -1) 
		{
			 
			System.out.println("Loading..."); 
		
			try{Thread.sleep(100);} 	//test
			
			catch(InterruptedException e) 
			{ System.out.println("Int!!!"); } 
			
		}
		
		while (this.myImage1.getHeight(this) == -1) 
		{ 
			System.out.println("Loading..."); 
			
			try{Thread.sleep(100);} 	//test
			
			catch(InterruptedException e) 
			{ System.out.println("Int!!!"); } 
			
		}
		
		System.out.println("HHHHHHHHHHHHHHHHHHH: " + this.myImage.getHeight(this)); 
		setSize(400, 400); 
		setBackground(Color.darkGray);
						 
	
		
		
	}
	
	
	//paint method. paints the image to the canvas
    public void paint(Graphics g) 
   {  
        
       // System.out.println("Spotting is being drawn");
       //g.drawOval(100, 100, 1000, 1000 );//int x, int y, int width, int height);
        
        
        
        g.drawImage(myImage, 175,150, this); //this.x,*/ this.y, this );// The image you want to draw
	                  									// The x position of the image
		    	   										// The y position of the image
		               									// The ImageObserver.   
		g.drawImage(myImage1, 130, 210, this);
		
	        
    }    
}   