advertisement
javaboutique
Search Tips
Articles  |   Tutorials  |   Reviews  |   Tools  |   by Category  |   by Date  |   by Name  |   Submit  |   Source  |   Forums  |  
javaboutique
Browse DevX


Partners & Affiliates











advertisement

piano




import java.awt.*;
import java.applet.*;
import java.util.*;
import java.net.*;

public class piano extends Applet  implements Runnable
{
    static int xx[] = new int[1024];
    static int yy[] = new int[1024];
    static int wktab[] = {0,2,4,5,7,9,11};
    static int bktab[] = {1,3,-1,6,8,10,-1};
    int n = 0;
    static int rsize = 4096;
    static int f = 0;
    Thread animator = null;
    Image ii,ii1;
    Graphics gg,gg1,gg2;
    AudioClip clip1;
    static int ttab[][] =
    {
	{15,27},
	{},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{22,34,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27,39,51},
	{39,51},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{34,22,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{40,52},
	{15,27},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{52},
	{15,27},
	{39,51},
	{},
	{39,51},
	{},
	{8},
	{11},
	{20},
	{8},
	{20},
	{23},
	{32},
	{20},
	{32},
	{35},
	{44},
	{32},
	{44},
	{47},
	{56},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{56,68},
	{39,44,48,56,68},
	{63},
	{39,44,48,65},
	{60},
	{39,44,48,63},
	{56,65},
	{39,44,48},
	{52,56},
	{40,44,47,52,56},
	{58},
	{40,44,47,52,59},
	{56},
	{39,44,48,58},
	{51,60},
	{39,44,48},
	{56},
	{39,44,48,51,60},
	{56},
	{39,43,46,51,58},
	{},
	{44,48,51,56},
	{},
	{},
	{44,56},
	{26,29,32,35,44,56},
	{},
	{26,41,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{44,56},
	{27,32,36,44,56},
	{51},
	{27,32,36,53},
	{48},
	{27,32,36,51},
	{44,53},
	{27,32,36},
	{40,44},
	{28,32,35,40,44},
	{46},
	{28,32,35,40,47},
	{44},
	{27,32,36,46},
	{39,48},
	{27,32,36},
	{44},
	{27,32,36,39,48},
	{44},
	{27,31,34,39,46},
	{},
	{32,36,39,44},
	{},
	{15,27},
	{},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{22,34,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27,39,51},
	{39,51},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{34,22,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{40,52},
	{15,27},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{52},
	{15,27},
	{39,51},
	{},
	{39,51},
	{},
	{8},
	{11},
	{20},
	{8},
	{20},
	{23},
	{32},
	{20},
	{32},
	{35},
	{44},
	{32},
	{44},
	{47},
	{56},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{56,68},
	{39,44,48,56,68},
	{63},
	{39,44,48,65},
	{60},
	{39,44,48,63},
	{56,65},
	{39,44,48},
	{52,56},
	{40,44,47,52,56},
	{58},
	{40,44,47,52,59},
	{56},
	{39,44,48,58},
	{51,60},
	{39,44,48},
	{56},
	{39,44,48,51,60},
	{56},
	{39,43,46,51,58},
	{},
	{44,48,51,56},
	{},
	{},
	{44,56},
	{26,29,32,35,44,56},
	{},
	{26,41,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{44,56},
	{27,32,36,44,56},
	{51},
	{27,32,36,53},
	{48},
	{27,32,36,51},
	{44,53},
	{27,32,36},
	{40,44},
	{28,32,35,40,44},
	{46},
	{28,32,35,40,47},
	{44},
	{27,32,36,46},
	{39,48},
	{27,32,36},
	{44},
	{27,32,36,39,48},
	{44},
	{27,31,34,39,46},
	{},
	{32,36,39,44},
	{},
	{21,33},
	{},
	{22,34},
	{55},
	{27,31,37,51,63},
	{55},
	{15,27,58},
	{50,62},
	{27,31,37},
	{58},
	{22,34,49,61},
	{55},
	{27,31,37,58},
	{48,60},
	{15,27,48,60},
	{55},
	{19,31,46,58},
	{55},
	{20,32},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36},
	{48},
	{20,32,44,56},
	{48},
	{27,32,36,51},
	{41,53},
	{20,32,41,53},
	{48},
	{21,33,41,53},
	{41,53},
	{22,34},
	{51},
	{27,31,37,43,55},
	{46},
	{15,27,49},
	{41,53},
	{27,31,37},
	{51},
	{22,34,43,55},
	{46},
	{27,31,37,49},
	{41,53},
	{22,34,41,53},
	{49},
	{23,35,41,53},
	{},
	{24,36},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36},
	{48},
	{20,32,44,56},
	{48},
	{27,32,36,51},
	{41,53},
	{20,32,41,53},
	{48},
	{21,33,41,53},
	{},
	{22,34},
	{55},
	{27,31,37,51,63},
	{55},
	{15,27,58},
	{50,62},
	{27,31,37},
	{58},
	{22,34,49,61},
	{55},
	{27,31,37,58},
	{48,60},
	{15,27,48,60},
	{55},
	{19,31,46,58},
	{55},
	{20,32},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36,41,53},
	{48},
	{20,32,44,56},
	{},
	{20,32,44,56},
	{},
	{19,31,43,55},
	{},
	{18,30,42,54},
	{},
	{17,29},
	{41},
	{17,29,45},
	{48},
	{21,33,53},
	{48},
	{21,33,45},
	{41},
	{22,34},
	{41},
	{29,34,37,46},
	{49},
	{29,34,37,41,53},
	{},
	{29,34,37,41,46,49},
	{},
	{22,29,34,38,41,44,48},
	{},
	{22,29,34},
	{38,41,44,48},
	{15,27},
	{37,46},
	{19,31},
	{39},
	{20,32,36,44},
	{},
	{27,32,36,39,51},
	{},
	{27,32,36,39,51},
	{},
	{21,33,39,51},
	{},
	{22,34},
	{55},
	{27,31,37,51,63},
	{55},
	{15,27,58},
	{50,62},
	{27,31,37},
	{58},
	{22,34,49,61},
	{55},
	{27,31,37,58},
	{48,60},
	{15,27,48,60},
	{55},
	{19,31,46,58},
	{55},
	{20,32},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36},
	{48},
	{20,32,44,56},
	{48},
	{27,32,36,51},
	{41,53},
	{20,32,41,53},
	{48},
	{21,33,41,53},
	{41,53},
	{22,34},
	{51},
	{27,31,37,43,55},
	{46},
	{15,27,49},
	{41,53},
	{27,31,37},
	{51},
	{22,34,43,55},
	{46},
	{27,31,37,49},
	{41,53},
	{22,34,41,53},
	{49},
	{23,35,41,53},
	{},
	{24,36},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36},
	{48},
	{20,32,44,56},
	{48},
	{27,32,36,51},
	{41,53},
	{20,32,41,53},
	{48},
	{21,33,41,53},
	{},
	{22,34},
	{55},
	{27,31,37,51,63},
	{55},
	{15,27,58},
	{50,62},
	{27,31,37},
	{58},
	{22,34,49,61},
	{55},
	{27,31,37,58},
	{48,60},
	{15,27,48,60},
	{55},
	{19,31,46,58},
	{55},
	{20,32},
	{48},
	{27,32,36,44,56},
	{48},
	{15,27,51},
	{41,53},
	{27,32,36,41,53},
	{48},
	{20,32,44,56},
	{},
	{20,32,44,56},
	{},
	{19,31,43,55},
	{},
	{18,30,42,54},
	{},
	{17,29},
	{41},
	{17,29,45},
	{48},
	{21,33,53},
	{48},
	{21,33,45},
	{41},
	{22,34},
	{41},
	{29,34,37,46},
	{49},
	{29,34,37,41,53},
	{},
	{29,34,37,41,46,49},
	{},
	{22,29,34,38,41,44,48},
	{},
	{22,29,34},
	{38,41,44,48},
	{15,27},
	{37,46},
	{19,31},
	{39},
	{20,32},
	{44},
	{27,32,36,48},
	{51},
	{27,32,36,44,56},
	{},
	{15,27},
	{},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{22,34,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27,39,51},
	{39,51},
	{20,32},
	{44},
	{27,32,36,39,51},
	{44},
	{27,32,36,48},
	{39,51},
	{21,33},
	{43},
	{34,22,39,51},
	{43},
	{27,31,37,46},
	{39,51},
	{27,31,37,39,51},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{40,52},
	{15,27},
	{39,51},
	{15,27},
	{39,51},
	{16,28},
	{44},
	{47},
	{52},
	{15,27},
	{39,51},
	{},
	{39,51},
	{},
	{8},
	{11},
	{20},
	{8},
	{20},
	{23},
	{32},
	{20},
	{32},
	{35},
	{44},
	{32},
	{44},
	{47},
	{56},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{},
	{38,41,44,47,56,68},
	{56,68},
	{39,44,48,56,68},
	{63},
	{39,44,48,65},
	{60},
	{39,44,48,63},
	{56,65},
	{39,44,48},
	{52,56},
	{40,44,47,52,56},
	{58},
	{40,44,47,52,59},
	{56},
	{39,44,48,58},
	{51,60},
	{39,44,48},
	{56},
	{39,44,48,51,60},
	{56},
	{39,43,46,51,58},
	{},
	{44,48,51,56},
	{},
	{},
	{44,56},
	{26,29,32,35,44,56},
	{},
	{26,41,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{},
	{26,29,32,35,44,56},
	{44,56},
	{27,32,36,44,56},
	{51},
	{27,32,36,53},
	{48},
	{27,32,36,51},
	{44,53},
	{27,32,36},
	{40,44},
	{28,32,35,40,44},
	{46},
	{28,32,35,40,47},
	{44},
	{27,32,36,46},
	{39,48},
	{27,32,36},
	{44},
	{27,32,36,39,48},
	{44},
	{27,31,34,39,46},
	{},
	{32,36,39,44},
	{},
	{44,56},
	{},
	{27,39,44,48,51,56},
	{},
	{15,27,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{18,30,46,48,51,56},
	{48,51},
	{32,36,42,46},
	{},
	{17,29,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{15,27,46,48,51,56},
	{48,51},
	{12,24,46},
	{48,51},
	{13,25,44},
	{49},
	{32,37,41,46},
	{49},
	{20,32,53},
	{44},
	{32,37,41,49},
	{53},
	{17,29,46},
	{49},
	{32,37,41,53},
	{44},
	{13,25,44},
	{53},
	{14,26,46},
	{53},
	{15,27,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{18,30,46,48,51,56},
	{48,51},
	{32,36,42,46},
	{},
	{17,29,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{15,27,46,48,51,56},
	{48,51},
	{12,24,46},
	{48,51},
	{13,25,44},
	{49},
	{32,37,41,46},
	{49},
	{20,32,53},
	{44},
	{32,37,41,49},
	{53},
	{17,29,46},
	{49},
	{32,37,41,53},
	{44},
	{13,25,44},
	{53},
	{12,24,45},
	{51,53},
	{10,22,46,50,53,58},
	{},
	{34,38,44},
	{48,50,53,58},
	{14,26,48,50,53,58},
	{50,53},
	{34,38,44,48},
	{},
	{17,29,46,50,53,58},
	{},
	{34,38,44,48,50,53,58},
	{48,50,53,58},
	{22,34,50,53},
	{48},
	{34,38,44,50,53},
	{},
	{15,27},
	{51},
	{34,39,42,46,58},
	{51},
	{18,30,54},
	{48,60},
	{34,39,42},
	{51},
	{15,27,46,58},
	{51},
	{34,39,42,54},
	{48,60},
	{18,30,48,60},
	{51},
	{34,39,42,46,58},
	{},
	{31,49,52,61},
	{34},
	{49,52,61},
	{37},
	{42,48,52,60},
	{37},
	{34,46,52,58},
	{31},
	{20,32,44,53},
	{49},
	{32,37,41,51},
	{46,54},
	{22,46,54},
	{46},
	{32,34,38,44,53},
	{},
	{27,34,37,43,53},
	{49},
	{27,34,37,51},
	{42,53},
	{32,36,42,53},
	{48},
	{32,36,42,51},
	{41,49},
	{25,37,41,49},
	{44,56},
	{32,37,41},
	{53},
	{32,37,41,44,56},
	{53},
	{14,26,44,56},
	{53},
	{15,27,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{18,30,46,48,51,56},
	{48,51},
	{32,36,42,46},
	{},
	{17,29,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{15,27,46,48,51,56},
	{48,51},
	{12,24,46},
	{48,51},
	{13,25,44},
	{49},
	{32,37,41,46},
	{49},
	{20,32,53},
	{44},
	{32,37,41,49},
	{53},
	{17,29,46},
	{49},
	{32,37,41,53},
	{44},
	{13,25,44},
	{53},
	{14,26,46},
	{53},
	{15,27,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{18,30,46,48,51,56},
	{48,51},
	{32,36,42,46},
	{},
	{17,29,44,48,51,56},
	{},
	{32,36,42},
	{46,48,51,56},
	{15,27,46,48,51,56},
	{48,51},
	{12,24,46},
	{48,51},
	{13,25,44},
	{49},
	{32,37,41,46},
	{49},
	{20,32,53},
	{44},
	{32,37,41,49},
	{53},
	{17,29,46},
	{49},
	{32,37,41,53},
	{44},
	{13,25,44},
	{53},
	{12,24,45},
	{51,53},
	{10,22,46,50,53,58},
	{},
	{34,38,44},
	{48,50,53,58},
	{14,26,48,50,53,58},
	{50,53},
	{34,38,44,48},
	{},
	{17,29,46,50,53,58},
	{},
	{34,38,44,48,50,53,58},
	{48,50,53,58},
	{22,34,50,53},
	{48},
	{34,38,44,50,53},
	{},
	{15,27},
	{51},
	{34,39,42,46,58},
	{51},
	{18,30,54},
	{48,60},
	{34,39,42},
	{51},
	{15,27,46,58},
	{51},
	{34,39,42,54},
	{48,60},
	{18,30,48,60},
	{51},
	{34,39,42,46,58},
	{},
	{31,49,52,61},
	{34},
	{49,52,61},
	{37},
	{42,48,52,60},
	{37},
	{34,46,52,58},
	{31},
	{20,32,44,53},
	{49},
	{32,37,41,51},
	{46,54},
	{22,46,54},
	{46},
	{32,34,38,44,53},
	{},
	{27,34,37,43,53},
	{49},
	{27,34,37,51},
	{42,53},
	{32,36,42,53},
	{48},
	{32,36,42,51},
	{41,49},
	{25,37,41,49},
	{49},
	{20,32,53},
	{56},
	{13,25,49,61},
	{},
	{24,36},
	{},
    };
    static boolean key[] = new boolean[128];

    public void init()
    {
	ii = createImage(640,320);
	ii1 = createImage(256,rsize);
	gg1 = ii1.getGraphics();
	gg = ii.getGraphics();
	gg2 = gg.create(320-128,16,256,96);
	gg1.setColor(new Color(255,255,255));
	gg1.fillRect(0,0,256,rsize);
	gg1.setColor(Color.black);
	for(int i=0;i<ttab.length;i++)
	    for(int j=0;j<ttab[i].length;j++)
		gg1.drawLine(ttab[i][j]*3+24,rsize-1-i*4,ttab[i][j]*3+24,rsize-4-i*4);
	gg.setColor(new Color(192,192,192));
	gg.fillRect(0,0,640,320);
    }

    public void draw3(Graphics g,int x0,int y0,int z0,int x1,int y1,int z1)
    {
	int zx = 320;
	int zy = 20;
	x0 = (x0 * (256-z0) + zx * z0)/256;
	y0 = (y0 * (256-z0) + zy * z0)/256;
	x1 = (x1 * (256-z1) + zx * z1)/256;
	y1 = (y1 * (256-z1) + zy * z1)/256;
	g.drawLine(x0,y0,x1,y1);
    }

    public void add3(Polygon p,int x0,int y0,int z0)
    {
	int zx = 320;
	int zy = 20;
	x0 = (x0 * (256-z0) + zx * z0)/256;
	y0 = (y0 * (256-z0) + zy * z0)/256;
	p.addPoint(x0,y0);
    }

    public void drawkey(Graphics g,int i)
    {
	int s0 = 6;
	int s0a = 3;
	int s1 = s0*2;
	int s2 = 25;
	int mode = 0;
	int ii = wktab[(i+70)%7] + ((i+70)/7-10)*12;
	boolean pp = key[ii+36];
	int yu = pp ? 166 : 160;

	if(1==1)
	{
	    Polygon p = new Polygon();
	    add3(p,320+i*s1-s0,yu,0);
	    add3(p,320+i*s1+s0,yu,0);
	    add3(p,320+i*s1+s0,yu,s2);
	    add3(p,320+i*s1-s0,yu,s2);
	    add3(p,320+i*s1-s0,yu,0);
	    g.setColor(Color.white);
	    g.fillPolygon(p);
	    g.setColor(Color.black);
	    g.drawPolygon(p);
	}
	else if(mode==1)
	{
	    Polygon p = new Polygon();

	    add3(p,320+i*s1-s0,yu,0);
	    add3(p,320+i*s1+s0,yu,0);
	    add3(p,320+i*s1+s0,yu,s2);
	    add3(p,320+i*s1-s0a,yu,s2);
	    add3(p,320+i*s1-s0a,yu,s2/2);
	    add3(p,320+i*s1-s0,yu,s2/2);
	    add3(p,320+i*s1-s0,yu,0);
	    g.setColor(Color.white);
	    g.fillPolygon(p);
	    g.setColor(Color.black);
	    g.drawPolygon(p);
	}
	else if(mode==2)
	{
	    Polygon p = new Polygon();

	    add3(p,320+i*s1-s0,yu,0);
	    add3(p,320+i*s1+s0,yu,0);
	    add3(p,320+i*s1+s0,yu,s2/2);
	    add3(p,320+i*s1+s0a,yu,s2/2);
	    add3(p,320+i*s1+s0a,yu,s2);
	    add3(p,320+i*s1-s0,yu,s2);
	    add3(p,320+i*s1-s0,yu,0);
	    g.setColor(Color.white);
	    g.fillPolygon(p);
	    g.setColor(Color.black);
	    g.drawPolygon(p);
	}
	else
	{
	    Polygon p = new Polygon();

	    add3(p,320+i*s1-s0,yu,0);
	    add3(p,320+i*s1+s0,yu,0);
	    add3(p,320+i*s1+s0,yu,s2/2);
	    add3(p,320+i*s1+s0a,yu,s2/2);
	    add3(p,320+i*s1+s0a,yu,s2);
	    add3(p,320+i*s1-s0a,yu,s2);
	    add3(p,320+i*s1-s0a,yu,s2/2);
	    add3(p,320+i*s1-s0,yu,s2/2);
	    add3(p,320+i*s1-s0,yu,0);
	    g.setColor(Color.white);
	    g.fillPolygon(p);
	    g.setColor(Color.black);
	    g.drawPolygon(p);
	}
	Polygon p = new Polygon();

	add3(p,320+i*s1-s0,yu,0);
	add3(p,320+i*s1+s0,yu,0);
	add3(p,320+i*s1+s0,168,0);
	add3(p,320+i*s1-s0,168,0);
	add3(p,320+i*s1-s0,yu,0);

	g.setColor(new Color(224,224,224));
	g.fillPolygon(p);
	g.setColor(Color.black);
	g.drawPolygon(p);
    }

    public void drawbkey(Graphics g,int i)
    {
	int s0 = 6;
	int s0a = 3;
	int s1 = s0*2;
	int s2 = 25;
	int mode;
	int ii = bktab[(i+70)%7] + ((i+70)/7-10)*12;
	if(ii+36<0) ii = -36;
	boolean pp = key[ii+36];
	int yu = pp ? 158 : 154;

	if(bktab[(i+70)%7]>=0)
	{
	    if(i<0)
	    {
		Polygon p = new Polygon();
		add3(p,320+i*s1+s1-s0a,yu,s2/2);
		add3(p,320+i*s1+s1-s0a,160,s2/2);
		add3(p,320+i*s1+s1-s0a,160,s2);
		add3(p,320+i*s1+s1-s0a,yu,s2);
		add3(p,320+i*s1+s1-s0a,yu,s2/2);
		g.setColor(new Color(64,64,64));
		g.fillPolygon(p);
		g.setColor(Color.black);
		g.drawPolygon(p);
	    }
	    if(i>0)
	    {
		Polygon p = new Polygon();
		add3(p,320+i*s1+s0a,yu,s2/2);
		add3(p,320+i*s1+s0a,160,s2/2);
		add3(p,320+i*s1+s0a,160,s2);
		add3(p,320+i*s1+s0a,yu,s2);
		add3(p,320+i*s1+s0a,yu,s2/2);
		g.setColor(new Color(64,64,64));
		g.fillPolygon(p);
		g.setColor(Color.black);
		g.drawPolygon(p);
	    }
	    {
		Polygon p = new Polygon();
		add3(p,320+i*s1+s0a,yu,s2/2);
		add3(p,320+i*s1+s1-s0a,yu,s2/2);
		add3(p,320+i*s1+s1-s0a,yu,s2);
		add3(p,320+i*s1+s0a,yu,s2);
		add3(p,320+i*s1+s0a,yu,s2/2);
		g.setColor(new Color(128,128,128));
		g.fillPolygon(p);
		g.setColor(Color.black);
		g.drawPolygon(p);
	    }
	    {
		Polygon p = new Polygon();
		add3(p,320+i*s1+s0a,yu,s2/2);
		add3(p,320+i*s1+s1-s0a,yu,s2/2);
		add3(p,320+i*s1+s1-s0a,160,s2/2);
		add3(p,320+i*s1+s0a,160,s2/2);
		add3(p,320+i*s1+s0a,yu,s2/2);
		g.setColor(new Color(64,64,64));
		g.fillPolygon(p);
		g.setColor(Color.black);
		g.drawPolygon(p);
	    }
	}
    }

    public void update(Graphics g)
    {
	gg.setColor(new Color(192,192,192));
	gg.fillRect(0,140,640,40);
	gg.setColor(Color.black);
	for(int i=23;i>0;i--)
	    drawkey(gg,i);
	for(int i=-21;i<0;i++)
	    drawkey(gg,i);
	drawkey(gg,0);
	for(int i=23;i>0;i--)
	    drawbkey(gg,i);
	for(int i=-21;i<0;i++)
	    drawbkey(gg,i);
	drawbkey(gg,0);
	gg2.drawImage(ii1,0,96-rsize+f*4+2,null);
	gg.setColor(Color.black);
	gg.drawLine(32,8,640-32,8);
	gg.drawLine(32,320-8,640-32,320-8);
	gg.drawLine(32,8,32,320-8);
	gg.drawLine(640-32,8,640-32,320-8);
	gg.drawLine(320-129,15,320+129,15);
	gg.drawLine(320-129,17+96,320+129,17+96);
	gg.drawLine(320-129,15,320-129,17+96);
	gg.drawLine(320+129,15,320+129,17+96);
	gg.drawLine(320-131,13,320+131,13);
	gg.drawLine(320-131,19+96,320+131,19+96);
	gg.drawLine(320-131,13,320-131,19+96);
	gg.drawLine(320+131,13,320+131,19+96);
	g.drawImage(ii,0,0,null);
    }

    public void run()
    {
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY-1);
	boolean breakout = false;

	long dd = (new Date()).getTime();
	int s = 2;
	while (animator != null)
	{
	    n = n + 1;
	    if(n>=ttab.length)
		n --;
	    for(int j = 0;j<128;j++)
		key[j] = false;
	    for(int j = 0;j<ttab[n].length;j++)
		key[ttab[n][j]] = true;
	    repaint(0,0,640,320);
	    s+=10;
	    f++;
	    while(true)
	    {
		try
		{
		    Thread.sleep(5);
		}
		catch(InterruptedException e)
		{
		    breakout = true;
		    break;
		}
		if((new Date()).getTime()-dd > (s*145125)/10000)
		    break;
	    }
	    if(breakout)
		break;
	}
    }

    public void start()
    {
	n = 0;
	f = 0;
        clip1 = getAudioClip(getCodeBase(), "test.au");
        if (clip1 != null)
            clip1.play();
        if (animator == null)
	{
            animator = new Thread(this);
            animator.start();
        }
    }

    public void stop()
    {
        if (animator != null)
	{
            animator.stop();
            animator = null;
        }
	clip1.stop();
    }

}

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.

 Internet.com eBook Library
 IBM Software Construction Toolbox
 Microsoft RIA Development Center
 Destination .NET
XML error: not well-formed (invalid token) at line 38
advertisement
Receive Articles via our XML/RSS feed
Receive Articles via our XML/RSS feed

JavaBytes
Internet Cyclone
This powerful, easy-to-use, internet optimizer is for Windows 95, 98, ME, NT, 2000 and XP. It's designed to automatically optimize your Windows settings, boosting your Internet connection up to 200%.

Mozilla's Ubquity Mashup: For The Masses?
iPhone Users Just Want to Have Fun
Oops! I Fixed the Linux Kernel
Jim Zemlin: The New Center of Linux Gravity
Microsoft's Novell Investment Tops $340M
Fedora 10 Takes Shape
IBM Gives a Mobile Voice to Developers
Inadequate Tools Send Software Down the Drain
USB 3.0 One Step Closer to Reality
Would-Be Linux Contributors May Get a Leg Up

Develop a Mobile RSS Feed the Easy Way
State of the Semantic Web: Know Where to Look
A 3D Exploration of the HTML Canvas Element
Setting Up and Running Subversion and Tortoise SVN with Visual Studio and .NET
Java/JRuby Developers, Say Open 'Sesame' to the Semantic Web
Interpreting Images with MRDS Services
DevXtra Editors' Blog: Executives Avoiding Cloud Computing in Droves
Q&A with James Reinders on the Intel Parallel Studio Beta Program
The Pros and Cons of Outsourcing Enterprise Emails
Hosting Options: Shared or Dedicated Server

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers