import java.awt.*;
import java.awt.event.*;
class game0712 extends Frame implements Runnable,MouseListener{
int t;
int mode;
Image img1,img2;
Image off;
Graphics offsc;
int coin;
String s[]=new String[100];
public static void main(String [] args) {
Frame f=new game0712();
f.setTitle("game0712");
f.setSize(500,600);
f.setBackground(Color.white);
f.setVisible(true);
}
game0712(){
s[0]="つきあってください";
s[1]="いいわよ";
s[2]="本当ですか";
s[3]="昔からあなたのことが好きだったの";
s[4]="本当ですか";
s[5]="夢のような話です";
s[6]="続く";
addMouseListener(this);
img1 = Toolkit.getDefaultToolkit().getImage("0219.jpg");
img2 = Toolkit.getDefaultToolkit().getImage("600.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.setColor(Color.black);
offsc.drawRect(0,500,500,100);
if(mode==0)offsc.drawImage(img1,0,500,100,100,this);
if(mode==1)offsc.drawImage(img2,0,500,100,100,this);
if(mode==2)offsc.drawImage(img1,0,500,100,100,this);
if(mode==3)offsc.drawImage(img2,0,500,100,100,this);
if(mode==4)offsc.drawImage(img1,0,500,100,100,this);
if(mode==5)offsc.drawImage(img1,0,500,100,100,this);
if(mode==6)offsc.drawImage(img1,0,500,100,100,this);
offsc.setColor(Color.black);
if(mode==0)offsc.drawString(s[0],100,520);
if(mode==1)offsc.drawString(s[1],100,520);
if(mode==2)offsc.drawString(s[2],100,520);
if(mode==3)offsc.drawString(s[3],100,520);
if(mode==4)offsc.drawString(s[4],100,520);
if(mode==5)offsc.drawString(s[5],100,520);
if(mode==6)offsc.drawString(s[6],100,520);
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:51