アットウィキロゴ

じゃば0311p

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

class game0311 extends Frame{  
int mx,nx;
int w=250;
int h=375;
int rgb[][]=new int[h][w];


game0311() {

gdata();

}

public static void main(String[] args) {
game0311 f = new game0311();
f.setSize(600,600);
f.setBackground(Color.blue) ;
f.setVisible(true);
f.addWindowListener(new WindowAdapter(){public void
windowClosing(WindowEvent e){System.exit(0);}});
}


public void paint( Graphics g ) {
for (mx=0;mx<h;mx++){
for (nx=0;nx<w;nx++){
g.setColor(Color.red);
if (rgb[mx][nx]>50)g.fillRect(100+nx,mx+100,1,1);
}
}
}


public void gdata(){
int n;
String s;
String a[]=new String[w*h];
String b[]=new String[3];

try {
n=0;
FileReader fr = new FileReader("data0309.csv");
BufferedReader br = new BufferedReader(fr);  
while((s = br.readLine()) != null) {  
a[n]=s;
n=n+1;
}
fr.close();
} catch (IOException e) {System.out.println(e);}
for (n=0;n<w*h;n++){
b=a[n].split(",");  
mx=Integer.valueOf(b[0]);
nx=Integer.valueOf(b[1]);
rgb[mx][nx]=Integer.valueOf(b[2]);
}
}


}
最終更新:2011年02月18日 11:27