Chandar S Vellithirumutha

Greenhorn

Posts: 15

posted 17 years ago

I am trying run an applet with the paint method as below. The paint method gets called in an infinite loop. CAn any one help me.

Thanks

Chandar

public void paint(Graphics g) {

setScale();

Graphics g1 = drawArea.getGraphics();

for (int i=0;i<noOfElements;i++) {setForeground(colorArray[i%colorArray.length]);

g.fillRect(i*BARGRAPHWIDTH,GRAPHHEIGHT - (int)

(scaleFactor * d[i]),BARGRAPHWIDTH,(int)(scaleFactor * d[i]));

}

}

public void setScale() {

int i = 0;

while((bigElement = bigElement/Math.pow(10,i)) > Integer.MAX_VALUE) i++;

for (int x=0;x<noOfElements;x++) {

intD[x] =(int)(d[i] = d[i]/Math.pow(10,i));

}

scaleFactor = GRAPHHEIGHT / bigElement;

return;

}

Thanks

Chandar

public void paint(Graphics g) {

setScale();

Graphics g1 = drawArea.getGraphics();

for (int i=0;i<noOfElements;i++) {setForeground(colorArray[i%colorArray.length]);

g.fillRect(i*BARGRAPHWIDTH,GRAPHHEIGHT - (int)

(scaleFactor * d[i]),BARGRAPHWIDTH,(int)(scaleFactor * d[i]));

}

}

public void setScale() {

int i = 0;

while((bigElement = bigElement/Math.pow(10,i)) > Integer.MAX_VALUE) i++;

for (int x=0;x<noOfElements;x++) {

intD[x] =(int)(d[i] = d[i]/Math.pow(10,i));

}

scaleFactor = GRAPHHEIGHT / bigElement;

return;

}