Does anybody know what is wrong with my java code?

Does anybody know what is wrong with my java code?

--Configuration: <Default>--

stockApplet.java:47: cannot find symbol

symbol : variable M_pointThread

location: class StockApplet

if (M_pointThread==null)

^

stockApplet.java:49: cannot find symbol

symbol : variable M_pointThread

location: class StockApplet

M_pointThread=new Thread(this);

^

stockApplet.java:50: cannot find symbol

symbol : variable M_pointThread

location: class StockApplet

THE CODE:

import java.applet.*;

import java.awt.*;

import java.io.*;

import java.net.*;

public class StockApplet extends java.applet.Applet implements Runnable

{

int Move_Length=0,Move_Sum=0;

String FileName,Name_Str,Content_Date;

int SP[]=new int[2000];

int KP[]=new int[2000];

int JD[]=new int[2000];

int JG[]=new int[2000];

int Mid_Worth[]=new int[2000];

String myDate[]=new String[2000];

double CJL[]=new double[2000];

double MaxCJL,MidCJL;

Label label[]=new Label[10];

int MaxWorth,MinWorth;

int x_move0,x_move1,MaxLength=0;

int x0,y0,X,Y,Record_Num;

boolean Mouse_Move,Name_Change=true;

int JX_Five1,JX_Five2,JX_Ten1,JX_Ten2;

public void init()

{

TextField text1=new TextField();

Thread M_pointThread=null;

setLayout(null);

this.setBackground(Color.white);

this.setForeground(Color.black);

for(int i=1;i< 10;i++)

{

label=new Label();

this.add(label);

label.reshape(i*80-65,10,50,15);

if(i==2){label.reshape(80,10,70,15);}

if(i==7){label.reshape(510,10,80,15);}

if(i >7){label.reshape((i-8)*490+45,380,70,15);}

}

FileName="six";

Name_Str="six";

this.add(text1);

text1.reshape(150,385,70,20);

text1.getText();

}

public void start()

{

if (M_pointThread==null)

{

M_pointThread=new Thread(this);

M_pointThread.start();

}

}

[2157 byte] By [rcajhta] at [2007-11-27 11:16:21]
# 1

You have this declared in one function:

Thread M_pointThread=null;

and M_pointTrhead used in another function.

Because the first function defines it within the function, its a local variable not visible to the second function.

Solution, move this outside of any function so it becomes a class variable visible to all functions as such:

private Thread M_pointThread=null;

George123a at 2007-7-29 14:18:39 > top of Java-index,Java Essentials,Java Programming...
# 2

thank you very much for your quick response.

rcajhta at 2007-7-29 14:18:39 > top of Java-index,Java Essentials,Java Programming...
# 3

Welcome to the forum. I think that George123 has your problem and its solution well in hand. Follow his good advice and you will have solved this problem. One other thing though just for future reference. If you post your code, here, you are going to want someone to be able to read it easily. Please use code tags when posting next time and your code will be much easier on the eye. You can find out about them here:

http://forum.java.sun.com/help.jspa?sec=formatting

petes1234a at 2007-7-29 14:18:39 > top of Java-index,Java Essentials,Java Programming...