アットウィキロゴ

ぎrl10215

import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
import java.io.*;

class pro extends Frame implements Runnable{

Frame f;
Thread th;
int t,ch,stage,x,y;
int w,h,m,n;
int select;

int memor[][][]=new int[5][500][500];
int memog[][][]=new int[5][500][500];
int memob[][][]=new int[5][500][500];

public static void main(String[] args){
Frame f=new pro();
f.setTitle("movie");
f.setSize(600,600);
f.setBackground(Color.yellow);
f.show();
}

pro() {
addWindowListener(new stopwin());

w=500;
h=500;


try{
BufferedReader br =new BufferedReader(new FileReader("zubon.txt"));
String[] test = new String[w*h];
String str;
String x[]=new String[5];
for(int i=0; i<w*h; i++){
str = br.readLine();
x=str.split(",");
m=Integer.valueOf(x[0]);
n=Integer.valueOf(x[1]);
memor[1][m][n]=Integer.valueOf(x[2]);
memog[1][m][n]=Integer.valueOf(x[3]);
memob[1][m][n]=Integer.valueOf(x[4]);
}
br.close();
}
catch(IOException e){System.out.println("入出力エラーです。");}

try{
BufferedReader br2 =new BufferedReader(new FileReader("skirt.txt"));
String str2;
String x2[]=new String[5];
for(int i=0; i<w*h; i++){
str2 = br2.readLine();
x2=str2.split(",");
m=Integer.valueOf(x2[0]);
n=Integer.valueOf(x2[1]);
memor[2][m][n]=Integer.valueOf(x2[2]);
memog[2][m][n]=Integer.valueOf(x2[3]);
memob[2][m][n]=Integer.valueOf(x2[4]);
}
br2.close();
}
catch(IOException e){System.out.println("入出力エラーです。");}

try{
BufferedReader br3 =new BufferedReader(new FileReader("satuki.txt"));
String str3;
String x3[]=new String[5];
for(int i=0; i<w*h; i++){
str3 = br3.readLine();
x3=str3.split(",");
m=Integer.valueOf(x3[0]);
n=Integer.valueOf(x3[1]);
memor[3][m][n]=Integer.valueOf(x3[2]);
memog[3][m][n]=Integer.valueOf(x3[3]);
memob[3][m][n]=Integer.valueOf(x3[4]);
}
br3.close();
}
catch(IOException e){System.out.println("入出力エラーです。");}

try{
BufferedReader br4 =new BufferedReader(new FileReader("yukari.txt"));
String str4;
String x4[]=new String[5];
for(int i=0; i<w*h; i++){
str4 = br4.readLine();
x4=str4.split(",");
m=Integer.valueOf(x4[0]);
n=Integer.valueOf(x4[1]);
memor[4][m][n]=Integer.valueOf(x4[2]);
memog[4][m][n]=Integer.valueOf(x4[3]);
memob[4][m][n]=Integer.valueOf(x4[4]);
}
br4.close();
}
catch(IOException e){System.out.println("入出力エラーです。");}


stage=1;
ch=1;
th=new Thread(this);
th.start();
}

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

public void paint( Graphics g ) {
int cc,j;
g.setColor(Color.blue);
g.fillRect(0,0,600,600);
g.setColor(Color.yellow);
g.fillRect(50,50,500,500);

g.setColor(Color.black);
g.drawRect(50,50,500,500);

g.setColor(Color.blue);
for (m=0;m<h;m++){
for (n=0;n<w;n++){
cc=0;
if(memor[ch][m][n]<200)cc=cc+1;
if(memog[ch][m][n]<200)cc=cc+1;
if(memob[ch][m][n]<200)cc=cc+1;
if(cc==3)g.fillRect(50+n,50+m,1,1);
}
}

g.setColor(Color.black);
if (stage==1)g.drawString("さつきさんに、サッカーの試合に誘われた。",200,500);
if (stage==2)g.drawString("正直、サッカーなんて興味がない。",200,500);
if (stage==3)g.drawString("僕が興味のあるのはさつきさんである。",200,500);
if (stage==4)g.drawString("私かわいい",200,500);
}

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

public void run() {

repaint();
try{th.sleep(2000);} catch(InterruptedException e) { }
stage=2;
ch=1;
repaint();
try{th.sleep(2000);} catch(InterruptedException e) { }

stage=3;
ch=1;
repaint();
try{th.sleep(2000);} catch(InterruptedException e) { }

ch=4;
stage=4;
repaint();

}
}
最終更新:2010年10月21日 01:06