staneja 0 Junior Poster in Training

i am woring on a project that finds the CPU temprature and shows in the graph. I am using applet to disply this.The CPU temp program is running and fter every minute the Image is modifed but when i m displaying the updated image in the applet it fails to load the updated image and shows the previous image to me

I want to execute through appletviewer as i dont want to show putut in web browser

This is the java code i am using for applet

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
/*
<applet code="applet_image" width=1500 height=550>
</applet>
*/


public class applet_image extends Applet implements Runnable {
boolean base=true;
int i=1;
Image img;
Thread t = null;
public  void init(){
setBackground(Color.black);
setForeground(Color.red );
System.out.println("Paint Method called "+i);
}


public void loadImage(){
img=getImage(getDocumentBase(),"null.jpg");
img=getImage(getDocumentBase(),"load-daily.jpg");



}
public void start() {
t = new Thread(this);


t.start();
}


public void run() {


for( ; ; ) {
repaint(150000000l);
}
}
public  void paint(Graphics g){
loadImage();
g.drawImage(img,0,0,this);
try{
Thread.sleep(1000L);
}catch(Exception e){}


}



}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.