Solved

Thread Error Message

Posted on 2004-09-01
7
202 Views
Last Modified: 2010-03-31
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?
0
Comment
Question by:iismatt
  • 4
  • 2
7 Comments
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 11959988
Thread ctor expects an instance of Runnabel.
so your class needs to implement Runnable
0
 
LVL 92

Expert Comment

by:objects
ID: 11959995
and thus will also need a run() method

public void run()
{
   // code to run in thread goes here
}
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11959997
have you implemented the run method ?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:iismatt
ID: 11960002
Yes...

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

      void runProg() {
            if (t_movement==null); {
                  Thread t_movement = new Thread(this);
                  t_movement.start();
            }
      }
0
 
LVL 92

Expert Comment

by:objects
ID: 11960030
then you just need to define that your class implements Runnable

public class myclass implements Runnable
{
...
0
 
LVL 1

Author Comment

by:iismatt
ID: 11960069
Yup, objects, you're right.  I forgot to implement Runnable.  Thanks.
0
 
LVL 92

Expert Comment

by:objects
ID: 11960092
no worries :)
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split string containing \r\n in Java 46 44
oracle 11g 23 83
How to convert String matching to regex in java 4 33
hibernate example for saving data 19 42
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question