アットウィキロゴ

AAAc

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package game;

/**
*
* @author ce00582
*/
import java.awt.*;
import java.awt.event.*;
import sub3.pro;

class game extends Frame implements Runnable{

int mode;
int t;
int card1,card2,card3;
String pdata;

public static void main(String [] args) {
       Frame f=[[new]] game(); 
       f.setTitle("game"); 
       f.setSize(700,700); 
       f.setBackground(Color.yellow); 
       f.setVisible(true); 
   } 

game(){

   pro p=new pro();
   p.makedata();
   pdata=p.pdata;
   
   System.out.println(pdata);
   
   t=0; 

Thread th=new Thread(this);
th.start();
addWindowListener(new stopwin());
}


class stopwin extends WindowAdapter{
   public void windowClosing(WindowEvent we){System.exit(0);} 
}


public void run(){
double x;
t=1;
mode=0;
while(t<30){

card1=1;
x=Math.random();
if (x>0.3)card1=2;
if (x>0.6)card1=3;

card2=1;
x=Math.random();
if (x>0.3)card2=2;
if (x>0.6)card2=3;

card3=1;
x=Math.random();
if (x>0.3)card3=2;
if (x>0.6)card3=3;

repaint();
try{
Thread.sleep(100);
}catch(InterruptedException e){}
t=t+1;
}
mode=100;
repaint();
}


public void paint(Graphics g){

if (mode<50){
g.setColor(Color.yellow);
g.fillRect(0,0,700,700);
g.setColor(Color.black);
if (card1==1)g.drawString("1",100,300);
if (card1==2)g.drawString("2",100,300);
if (card1==3)g.drawString("3",100,300);

if (card2==1)g.drawString("1",200,300);
if (card2==2)g.drawString("2",200,300);
if (card2==3)g.drawString("3",200,300);

if (card3==1)g.drawString("1",300,300);
if (card3==2)g.drawString("2",300,300);
if (card3==3)g.drawString("3",300,300);
}

if(mode>50){
g.setColor(Color.yellow);
g.fillRect(0,0,700,700);
g.setColor(Color.black);
g.drawString("駄目でした",100,300);
}



}
}
最終更新:2011年08月17日 21:36