import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import javax.sound.sampled.*;
class
pro extends Frame implements Runnable{
Frame f;
Thread th;
int t,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;
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[stage][m][n]<200)cc=cc+1;
if(memog[stage][m][n]<200)cc=cc+1;
if(memob[stage][m][n]<200)cc=cc+1;
if(cc==3)g.fillRect(50+n,50+m,1,1);
}
}
}
public void update(Graphics g) {
paint(g);
}
public void run() {
repaint();
try{th.sleep(1000);} catch(InterruptedException e) { }
stage=2;
repaint();
try {URL url = this.getClass().getClassLoader().getResource("sound.wav");
AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
Clip clip = AudioSystem.getClip();
clip.open(audioIn);
clip.start();}
catch (UnsupportedAudioFileException e) {e.printStackTrace();}
catch (IOException e) {e.printStackTrace();}
catch (LineUnavailableException e) {e.printStackTrace();}
try{th.sleep(3000);} catch(InterruptedException e) { }
stage=3;
repaint();
try{th.sleep(1000);} catch(InterruptedException e) { }
stage=4;
repaint();
try {URL url = this.getClass().getClassLoader().getResource("sp.wav");
AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
Clip clip = AudioSystem.getClip();
clip.open(audioIn);
clip.start();}
catch (UnsupportedAudioFileException e) {e.printStackTrace();}
catch (IOException e) {e.printStackTrace();}
catch (LineUnavailableException e) {e.printStackTrace();}
}
}
最終更新:2010年10月20日 23:05