import javax.swing.JFrame;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

public class ShowImage extends JFrame
{

	private static BufferedImage image = null;	// Stores a picture image

	public void paint(Graphics g)
	{
		super.paint(g);
		g.drawImage( image, 5, 35, null);	// Draws the image
	}

	public ShowImage()
	{
		setSize(810, 645);  // Size of the window in pixels
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setVisible(true);
	}

	//-----------------------------------------------------------
	/**
	 * Methods to help manipulate colors
	 * You don't have to worry about how these work, but ask
	 * me if you are curious.
	*/
	private static int makeRGBColor(int red, int green, int blue)
	{
		int rgb = 0;
		rgb = red*65536 + green*256 + blue;
		return rgb;
	}

	private static int getRed(int pixel)
	{
		return (pixel >> 16) & 0xFF;
	}

	private static int getGreen(int pixel)
	{
		return (pixel >> 8) & 0xFF;
	}

	private static int getBlue(int pixel)
	{
		return (pixel) & 0xFF;
	}

	//-----------------------------------------------------------

	/**
	 * Main method.  You have to add the "throws Exception" at
	 * the end here.  Later we will see a better way to do this
	 * using "try" and "catch".
	*/
	public static void main(String[] args) throws Exception
	{
		ShowImage myWindow = new ShowImage();

		// These next two lines read the image from the file
		File input = new File("MyKids.jpg");
		image = ImageIO.read(input);


		// **** Add code here to manipulate the image *****


		myWindow.repaint();
	}
}
