how to reload aplet automatically

i have made a graph in applet which draw signal lines. i want applet show first line, after 1 second reload applet and draw second line preserving previous value.receiving values from a table having two fields 1.seconds...2.active_calls_count ..give dynamic sort of look...just like window's Task Manager-->Performance graph

code of Signal wave graph is below here..can anyone help me regarding this..

import java.applet.*;

import java.awt.*;

import java.awt.Dimension;

import java.awt.Graphics;

import java.lang.*;

import java.awt.Color;

import java.sql.*;

public class SignalWave extends Applet

{

public void init()

{

setBackground(Color.WHITE);

setForeground(Color.BLUE);

}

/**Paint function is used to draw the graph on applet...*/

public void paint(Graphics g)

{

String query="select SEC,ACTIVE_CALLS_COUNT from bill.tbl_temp_calls";

xDatabase db=new xDatabase() ;

int temp=db.executeSQL(query,true);

if(temp<0)

{

//out.println("DataBase:ERROR");

}

int recCount=db.ResultSetRowCount() ;

//String sec=db.getStringVal(1);

//String active_calls=db.getStringVal(2) ;

Dimension d = getSize();

for(int i=0;i<recCount;i++)

{

g.drawLine(4,4,(int)db.getStringVal(1),(int)db.getStringVal(2)) ;

}

//for (int x = 0; x >< d.width; x++)

//{

//g.drawLine(x, 50 + (int) func(x), x + 1, 50 + (int) func(x + 1));

// }

}//end of paint method

/** This is the function that is plotted. */

double func(double x)

{

Dimension d = getSize();

double c;

c=(Math.cos(x / 25) + Math.sin(x / 18) + 4) * d.height / 8;

return c;

}//end of plot function

}

[1826 byte] By [FaiyazAziza] at [2007-11-27 10:11:20]
# 1

try using Thread and Timer.

Yannixa at 2007-7-28 15:12:35 > top of Java-index,Desktop,Core GUI APIs...