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?
LVL 1
iismattAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
objectsConnect With a Mentor Commented:
Thread ctor expects an instance of Runnabel.
so your class needs to implement Runnable
0
 
objectsCommented:
and thus will also need a run() method

public void run()
{
   // code to run in thread goes here
}
0
 
armoghanCommented:
have you implemented the run method ?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
iismattAuthor Commented:
Yes...

      public void run() {
            movingRandRect mrr = new movingRandRect();
      }

      void runProg() {
            if (t_movement==null); {
                  Thread t_movement = new Thread(this);
                  t_movement.start();
            }
      }
0
 
objectsCommented:
then you just need to define that your class implements Runnable

public class myclass implements Runnable
{
...
0
 
iismattAuthor Commented:
Yup, objects, you're right.  I forgot to implement Runnable.  Thanks.
0
 
objectsCommented:
no worries :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.