iismatt
asked on
Thread Error Message
I am getting the error message
symbol : constructor Thread(PaintWindow)
location: class java.lang.Thread
Thread t_movement = new Thread(this);
however, I have java.util.* defined in my class. What gives?
symbol : constructor Thread(PaintWindow)
location: class java.lang.Thread
Thread t_movement = new Thread(this);
however, I have java.util.* defined in my class. What gives?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
have you implemented the run method ?
ASKER
Yes...
public void run() {
movingRandRect mrr = new movingRandRect();
}
void runProg() {
if (t_movement==null); {
Thread t_movement = new Thread(this);
t_movement.start();
}
}
public void run() {
movingRandRect mrr = new movingRandRect();
}
void runProg() {
if (t_movement==null); {
Thread t_movement = new Thread(this);
t_movement.start();
}
}
then you just need to define that your class implements Runnable
public class myclass implements Runnable
{
...
public class myclass implements Runnable
{
...
ASKER
Yup, objects, you're right. I forgot to implement Runnable. Thanks.
no worries :)
public void run()
{
// code to run in thread goes here
}