// 2Á¶ : ±è¼º¹®, ±èºÐ¸², ÇÑ¿ì¼±, ºÀ¼ºÃ¶


import java.awt.*;
import java.awt.event.*;
import java.util.Random;

class LottoMain
{
	static String str[]=new String[5];
	static String [] name = {"±âÅÂÈÆ", "±âÈ¿¼±", "±èÁø¿õ", "·ù¿¬¿ì", "¹®Ã¢±â","¹ÚÁ¤Çö",
									"¹ÚÁ¾¼®", "¹ÚÁöÈ«", "¹ÚÇö¹Î", "ÀÌ¼¼¿¬", "ÀÌ¿ëÁØ", "ÀÌÀ±³ª",
									"ÀÌÀç´Þ", "ÀÓÁöÈÆ", "ÀüÇýÁø", "Á¤»óÀÎ", "ÃÖÁ¤ÈÆ", "ÇÏ°æ¿ì"};
	LottoMain() {
		int [] array = {0,0,0,0,0};
		int i = 0;

		Random rand = new Random();

		for( i = 0 ; i < array.length ; i++){
			int num = rand.nextInt(18);
			array[i] = num;
			for ( int j = 0 ; j < i ; j++) {
				if ( array[j] == array[i] )
					i--;
			}
		}	

		for( i = 0 ; i < array.length ; i++){
			
//			System.out.print(name[array[i]] + " ");
			str[i]=name[array[i]];
		}
	}
}




class ClassMain extends Frame implements ActionListener{
	private Button start;
	private TextField tf1,tf2, tf3, tf4, tf5;
	private Label l1, l2, l3, l4, l5, l6;
	private Panel p1;

	ClassMain(String s){
		super(s);
		this.setGUI();
		this.setEvent();
		this.setSize(400,100);
		Toolkit t=Toolkit.getDefaultToolkit();		// Ã¢À» °¡¿îµ¥ Á¤·ÄÇÏ±â À§ÇØ¼­ ÀüÃ¼ È­¸é¿¡ ´ëÇÑ Á¤º¸¸¦ °®´Â Toolkit Å¬·¡½º °´Ã¼ »ý¼º
		Dimension d=t.getScreenSize();			// ÀüÃ¼ È­¸éÀÇ Å©±â¿¡ ´ëÇÑ °ªÀ» Dimension ÇüÅÂ·Î ºÒ·¯¿È
		Dimension dim=this.getSize();				// ÇÁ·¹ÀÓÀÇ Å©±â¿¡ ´ëÇÑ °ªÀ» Dimension ÇüÅÂ·Î ºÒ·¯¿È
		setLocation((int)(d.getWidth()/2-dim.getWidth()/2), (int)(d.getHeight()/2-dim.getHeight()/2)); // ÇÁ·¹ÀÓÀ» È­¸éÀÇ °¡¿îµ¥ À§Ä¡ ÇÏµµ·Ï ¼³Á¤
		this.setVisible(true);
	}

	public void setGUI(){
		p1=new Panel();
		p1.setLayout(new GridLayout(2, 5));
//		p1.setBackground(Color.blue);

		this.setLayout(new BorderLayout());
		
		l1=new Label("½ÉºÎ¸§");
		l2=new Label("5000");
		l2.setForeground(Color.pink);
		l3=new Label("4000");
		l3.setForeground(Color.orange);
		l4=new Label("6000");
		l4.setForeground(Color.yellow);
		l5=new Label("5000");
		l5.setForeground(Color.blue);

		tf1=new TextField();	
		tf2=new TextField();
		tf3=new TextField();
		tf4=new TextField();
		tf5=new TextField();

		start=new Button("½ÃÀÛ");

		p1.add(l1);		
		p1.add(l2);
		p1.add(l3);
		p1.add(l4);
		p1.add(l5);

		p1.add(tf1);
		p1.add(tf2);
		p1.add(tf3);
		p1.add(tf4);
		p1.add(tf5);

		l6 = new Label("                      °­»ç´Ô »ç¶ûÇØ¿ä~~~¢½");

		this.add(p1, "Center");
		this.add(start, "East");
		this.add(l6, "South");
	}

	void setEvent(){
		start.addActionListener(this);
	}

	public void actionPerformed(ActionEvent ae) {
		tf1.setText("");
		tf2.setText("");
		tf3.setText("");
		tf4.setText("");
		tf5.setText("");
		LottoMain lm=new LottoMain();
		for(int i=0;i<5;i++){
//			System.out.println(LottoMain.str[i]);
			try{
				switch(i){
					case 0:
						tf1.setText(LottoMain.str[0]);

						Thread.sleep(2000);
						break;

					case 1:
						tf2.setText(LottoMain.str[1]);
						Thread.sleep(2000);
						break;

					case 2:
						tf3.setText(LottoMain.str[2]);
						Thread.sleep(2000);
						break;

					case 3:
						tf4.setText(LottoMain.str[3]);
						Thread.sleep(2000);
						break;

					case 4:
						tf5.setText(LottoMain.str[4]);
						Thread.sleep(2000);
						l6.setForeground(Color.red);
						l6.setText("                      Àß ¸Ô°Ú½À´Ï´Ù ^0^");
						break;
				}
			}catch(Exception e){
			}
		}
	}
}


class OurClass{
	public static void main(String args[]){
		ClassMain cm=new ClassMain("¿ì¸®¹Ý ¸í´Ü ·Î¶Ç");
	}

}
