what i have been noticing is that it is displaying everything but when it needs to update the graph it doesnt update it until you close and reopen the webpage. is it because is reading again and again the data from the webpage that i am getting the information from? or what could it be? it updates itself in the viewer.

Your creating and calling classes and methods needs some analysis.
For example you create an webdata object inside of the paintComponent object.
The webdata object should be run outside of the paintComponent method to gather the data and then a call to repaint would be done to have the paintComponent method called to display the data that the webdata class has gathered.

i already did that and stills doesnt update until i close all my webpages and i reload the webpage again.

i put the webdata object in the maingui class in the run method but still doesnt make a difference it doesnt update though.

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class MainGUI extends java.applet.Applet implements Runnable {
int xaxis[]=new int[1000];
int yaxisp[];
double xdata[];
double ydata[];
int Adx=-800;
String dates;
String htmldata[]=new String[1000];
//Double Buffering
private Image dbImage;
private Graphics dbg;
//Clear Screen
		boolean clear;
		Thread th;
public void init(){
	
	setSize(1300,600);
	
	//System.out.println(htmldata[1]);
for(int k=0;k<=32;k++){
	xaxis[k]=k*100;
}
}
public void start(){

	if(th==null)
	{
		th=new Thread(this);
		th.start();
	}
}

public void stop(){
	if(th!=null)
	{
		th.stop();
		th=null;
	}
}
public String now(String dateFormat) {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
    return sdf.format(cal.getTime());

  }
public void run(){
	while(true){
		
		 webdata w=new webdata();
			htmldata=w.TheArray();
			
			
		repaint();
		try {
			Thread.sleep(500);
		    } catch (InterruptedException e) {
			
		    }
		
	}
}
public void clear(Graphics g)
{
// if(!clear)return; // optional
	
g.setColor(getBackground());
g.fillRect(0,0,(int)this.getWidth(),(int)this.getHeight());
clear=false;
}
public void update(Graphics g){
	
	if(dbImage==null){
	dbImage=createImage(this.getSize().width,this.getSize().height);
		dbg=dbImage.getGraphics();
	}
	dbg.setColor(getBackground());
	dbg.fillRect(0, 0, this.getSize().width, this.getSize().height);
	dbg.setColor(getForeground());
	paint(dbg);
	g.drawImage(dbImage, 0, 0, this);
}

public void paint(Graphics g){
	
	Graph spr=new Graph();
	spr.paintComponent(g, xaxis,htmldata);
	
	g.setColor(Color.BLACK);
	g.drawString("Real Time Energy Price For "+	now("MMMMM dd, yyyy hh:mm:ss"), 290, 13);
	
}

}
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.