アットウィキロゴ

じゃヴぁ0311

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

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


game0312() {
csvdata();
}

public static void main(String[] args) {
game0312 f = new game0312();
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 csvdata(){
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*1 != 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:33