new Thread and error symbol:Constructor
Hi everybody, i'm a new to java
I have written a dictionary application for my mobile. The program works fine with this code:
...
publicvoid commandAction(Command c, Displayable p)
{
if (c == WN.cmdBack)
{
display.setCurrent(parent);
}
elseif (c == WN.cmdSelect)
{
int selected = getSelectedIndex();
if (selected >= 0)
{
Definition definition =new Definition(wordLists, selected);
ResultForm resultForm =new ResultForm(definition.word, definition.def, display,this);
display.setCurrent(resultForm);
}
}
}
...
But the Toolkit said that i should create a new thread, so I changed the code to:
publicvoid commandAction(Command c, Displayable p)
{
if (c == WN.cmdBack)
{
display.setCurrent(parent);
}
elseif (c == WN.cmdSelect)
{
new ThreadResult().start();
}
}
publicclass ThreadResultextends Thread
{
publicvoid run()
{
try
{
int selected = getSelectedIndex();
if (selected >= 0)
{
Definition definition =new Definition(wordLists, selected);
resultForm =new ResultForm(definition.word, definition.def, display,this);
display.setCurrent(resultForm);
}
}
catch (Exception ex)
{
thrownew Error("Err.#3\n" + ex);
}
}
}
ResultForm.java:
publicclass ResultFormextends Formimplements CommandListener
{
private Display display;
private Displayable parent;
public ResultForm(String w, String m, Display d, Displayable p)
{
super(w +":");
display = d;
parent = p;
append(m);
addCommand(WN.cmdBack);
setCommandListener(this);
}
publicvoid commandAction(Command c, Displayable p)
{
if(c == WN.cmdBack)
{
display.setCurrent(parent);
}
}
}
but it says error when compiling:
cannot find symbol
symbol : constructor ResultForm(java.lang.String,java.lang.String,javax.microedition.lcdui.Display,BuildList.ThreadResult)
location: class ResultForm
resultForm = new ResultForm(definition.word, definition.def, display, this);
^
I don't know why, please help...
Thanks in advance.

