File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Problems in the paint method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Problems in the paint method" Watch "Problems in the paint method" New topic
Author

Problems in the paint method

Chandar S Vellithirumutha
Greenhorn

Joined: May 29, 2000
Posts: 15
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;
}
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This is really a question for the Applets forum


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems in the paint method
 
Similar Threads
Problem in running the Applet in a browser
please can you help to identify those errors
help with game
using graphics object
Instance of Graphics ,g , can't be recognized in applen