アットウィキロゴ

java0711x

import java.awt.*;
import java.awt.event.*;

class game0711 extends Frame implements Runnable,MouseListener{

int t;
int mode;
Image img1;
Image off;
Graphics offsc;
int coin;
String s[]=new String[100];

public static void main(String [] args) {
        Frame f=new game0711();
        f.setTitle("game0711");
        f.setSize(500,600);
        f.setBackground(Color.white);
        f.setVisible(true);
    }

game0711(){

s[0]="0";
s[1]="a";
s[2]="bc";
s[3]="def";
s[4]="ghij";
s[5]="klmno";
s[6]="pqrstu";

addMouseListener(this);
img1 = Toolkit.getDefaultToolkit().getImage("0219.jpg");
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(){  
t=0;
mode=0;
coin=0;
while(t<100){
mode=mode+1;
if(mode>6)mode=0;
coin=0;
repaint();
try{
Thread.sleep(1000);
}catch(InterruptedException e){}
t=t+1;  
}  

}

public void update(Graphics g){
paint(g);
}


public void paint(Graphics g){

off = createImage(500,600);
offsc = off.getGraphics();
offsc.drawImage(img1,0,0,500,500,this);    
offsc.setColor(Color.white);
offsc.fillRect(0,500,500,100);  
offsc.drawImage(img1,0,500,100,100,this);
offsc.setColor(Color.black);
if(mode==0)offsc.drawString(s[0],100,500);
if(mode==1)offsc.drawString(s[1],100,500);
if(mode==2)offsc.drawString(s[2],100,500);
if(mode==3)offsc.drawString(s[3],100,500);
if(mode==4)offsc.drawString(s[4],100,500);
if(mode==5)offsc.drawString(s[5],100,500);
if(mode==6)offsc.drawString(s[6],100,500);
g.drawImage(off,0,0,this);
}
public void mouseEntered(MouseEvent e){
}

public void mouseExited(MouseEvent e){
}

public void mousePressed(MouseEvent e){
}

public void mouseReleased(MouseEvent e){
}

public void mouseClicked(MouseEvent e){  
double ex,ey;
ey=e.getY() ;
ex=e.getX();  
if (ey>550)coin=1;
if(ey<550)coin=2;
}





}
最終更新:2011年02月27日 12:31