/*
 * 作成日: 2008/01/06
 */
package asandatabasebrowser.view;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;

import javax.swing.JComponent;

/** 洒落で作ったアニメーション.(^^; */ 
public class AnimationPanel extends JComponent implements Runnable {
	static final int MAX_COUNT = 100;
	int count = 0;
	public void paintComponent(Graphics g) {
		Graphics2D g2 = (Graphics2D) g;
		g2.setColor(Color.BLACK);
		g2.fillRect(0,0, 1000, 1000);
		g2.setFont(new Font("Dialog", Font.PLAIN, (10+count)/3));
		g2.setColor(Color.GRAY);
		g2.drawString("Asan Database Browser", 100+(100-count), 100+(100-count));
		g2.setColor(Color.WHITE);
		g2.draw(new Ellipse2D.Double(0,0, count*10, count*10));
		g2.drawString("Asan Database Browser", 100, 100);
		if (count == MAX_COUNT) {
			g2.setFont(new Font("Dialog", Font.PLAIN, 12));
			g2.drawString("version 0.00", 200, 160);
			g2.drawString(
					"Copyright(C) 2002-2009. Yoshinori Watanabe (A-san).",
					 200, 180);
			g2.drawString(" All rights reserved.", 200, 200);
		}
		
	}
	public void run() {
		for (int i=0; i<MAX_COUNT; i++) {
			try {
				Thread.sleep(20L);	// 1sec
			} catch (InterruptedException e) {
			}
			count++;
			repaint();
		}
	}
}
