LIST 77 ============================================================================ import java.awt.*; import java.applet.*; import java.util.*; import java.net.*; public class sample sample Applet implements Runnable { int j=0, color_sel=1, xx=70, yy=25, sz=10, st=12, mode=1; Image i[] = new Image[15]; private Thread flow; int m[][][] = { { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 0 { {0,0,1,0,0}, {0,1,1,0,0}, {0,0,1,0,0}, {0,0,1,0,0}, {0,0,1,0,0}, {0,0,1,0,0}, {0,1,1,1,0} }, // 1 { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,0,0,1,0}, {0,0,1,0,0}, {0,1,0,0,0}, {1,1,1,1,1} }, // 2 { {0,1,1,1,0}, {1,0,0,0,1}, {0,0,0,0,1}, {0,0,1,1,0}, {0,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 3 { {0,0,0,1,0}, {0,0,1,1,0}, {0,1,0,1,0}, {1,0,0,1,0}, {1,1,1,1,1}, {0,0,0,1,0}, {0,0,0,1,0} }, // 4 { {1,1,1,1,1}, {1,0,0,0,0}, {1,0,0,0,0}, {1,1,1,1,0}, {0,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 5 { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,0}, {1,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 6 { {1,1,1,1,1}, {1,0,0,0,1}, {0,0,0,0,1}, {0,0,0,1,0}, {0,0,1,0,0}, {0,1,0,0,0}, {1,0,0,0,0} }, // 7 { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 8 { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,1}, {0,0,0,0,1}, {1,0,0,0,1}, {0,1,1,1,0} }, // 9 }; public void init(){ URL docBase = getDocumentBase(); for(int n=1;n<=14;n++){ i[n] = getImage( docBase, "java/gif/b"+n+".gif"); } setBackground(Color.black); } public void start(){ flow = new Thread(this); flow.start(); } public void run() { try { while (true) { flow.sleep(1000); repaint(); } } catch (Exception e){ j++; }; } public void stop() { flow.stop(); } public void paint(Graphics g) { Dimension dd = size(); g.clearRect(0, 0, dd.width, dd.height); Date d = new Date(); int u1 = d.getHours(); int u2 = d.getMinutes(); int u3 = d.getSeconds(); clock_disp(g,u1,u2,u3); } void clock_disp(Graphics g, int u1, int u2, int u3){ int addx, addy, dat, datt, color_buf=1; addy = yy; if(mode != 0){ color_buf = color_sel; sz += 3; st += 2; xx -= 40; yy -= 5; } addx = xx + st * 28; dat = u3 / 10; char_disp(g,addx,addy,dat); addx = xx + st * 34; datt = u3 % 10; char_disp(g,addx,addy,datt); addx = xx + st * 14; dat = u2 / 10; char_disp(g,addx,addy,dat); addx = xx + st * 20; dat = u2 % 10; char_disp(g,addx,addy,dat); addx = xx; dat = u1 / 10; char_disp(g,addx,addy,dat); addx = xx + st * 6; dat = u1 % 10; char_disp(g,addx,addy,dat); addx = xx + st * 12; char_dot(g,addx,addy); addx = xx + st * 26; char_dot(g,addx,addy); if(mode != 0){ color_sel = color_buf; sz -= 3; st -= 2; xx += 40; yy += 5; } if(datt ==9){ color_sel++; if(color_sel>14) color_sel=1; } if(Math.random() > 0.93) mode=1; else mode=0; } void char_dot(Graphics g, int addx, int addy){ dot_draw(g, addx, addy + (int)((double)st * 1.5)); dot_draw(g, addx, addy + (int)((double)st * 4.5)); } void dot_draw(Graphics g, int adx, int ady){ int color_res; if(mode == 0){ color_res = color_sel; } else{ color_res = 1 + ((int)(Math.random() * 999.0)) % 14; } g.drawImage(i[color_res], adx, ady, sz, sz, this); } void char_disp(Graphics g, int addx, int addy, int dat){ for( int i=0; i<5; i++){ for (int j=0; j<7; j++){ if( m[dat][j][i] ==1 ){ dot_draw(g, addx + st * i, addy + st * j); } } } } } ============================================================================