media @ VU
applet-math-colors.jva
applet-math-colors.jva
/ applet-math-colors
// percolation, Evgeny Demidov 14 Oct 2001
import java.awt.*;
import java.awt.event.*;
public class applet-math-colors extends java.applet.Applet{
int maxColor = 18, d = 20;
Color col[];
public void init() {
col = new Color[maxColor];
col[0] = Color.red; col[3] = new Color(0,200,0); col[6] = Color.blue;
col[9] = new Color(220,220,0); col[12] = new Color(0,220,220);
col[15] = new Color(255,0,255);
col[1] = new Color(255,150,150); col[4] = new Color(120,255,120);
col[7] = new Color(150,150,255); col[10] = new Color(255,255,120);
col[13] = new Color(120,255,255); col[16] = new Color(255,150,255);
for (int i = 0; i < 18; i += 3) col[i+2] = col[i].darker();
}
public void paint(Graphics g) {
for (int i = 0; i < maxColor; i++){
g.setColor(col[i]);
g.fillRect(i*d,0, d, 50);}
}
public void update(Graphics g){ paint(g); }
}
(C) A. Eliëns
2/9/2007
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.