/*
 * Created on 2004/10/18
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package jp.riken.brain.ni.samuraigraph.application;

/**
 * @author kuromaru
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;

import jp.riken.brain.ni.samuraigraph.base.*;
import jp.riken.brain.ni.samuraigraph.data.*;
import jp.riken.brain.ni.samuraigraph.figure.*;
import jp.riken.brain.ni.samuraigraph.figure.java2d.*;


public class SGSplashWindow extends JWindow
//implements Runnable
{

	/**
	 * 
	 */
	private Image mImage;


	/**
	 * 
	 */
	private Dimension mImageSize = new Dimension();


	/**
	 * 
	 * @param win
	 */
	public SGSplashWindow( Image img )
	{
		MediaTracker mt = new MediaTracker(this);

		Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		
		this.mImage = img;

		mt.addImage( img, 0 );
		try
		{
			mt.waitForAll();
		}
		catch (InterruptedException ex)
		{
			ex.printStackTrace();
		}

		mImageSize.width = mImage.getWidth(this);
		mImageSize.height = mImage.getHeight(this);

		this.setBounds(
			( screen.width - mImageSize.width )/2,
			( screen.height - mImageSize.height )/2,
			mImageSize.width,
			mImageSize.height
		);

//		this.setVisible(true);

	}



	/**
	 * 
	 */	
	public void paint( Graphics g )
	{
		g.drawImage(
			mImage, 0, 0, 
			mImageSize.width, mImageSize.height,
			this
		);
	}



	/**
	 * 
	 */
/*	public void run()
	{
		try
		{
			Thread.sleep(10000);
		}
		catch (InterruptedException ex)
		{
			ex.printStackTrace();
		}
	
		setVisible(false);
	}
*/


}

