please can someone tell me what is meant by this
both class javax.swing.Timer in javax.swing and class java.util.Timer in java.util match
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
please can someone tell me what is meant by this
both class javax.swing.Timer in javax.swing and class java.util.Timer in java.util match
Last edited by stresstedout; April 10th, 2014 at 07:33 PM.
There are two Timer classes. One in the javax.swing package and one in the java.util package. The compier needs to be told which one to use.
One way is to explicitly code the package name with the class name:
javax.swing.Timer myTimer = new javax.swing.Timer(...);
then the compiler will know which one to use.
If you don't understand my answer, don't ignore it, ask a question.
In a java program.
If you don't understand my answer, don't ignore it, ask a question.
so i have ammened to following
that but i am still getin this errorjavax.swing.Timer myTimer = new javax.swing.Timer(1000, new TimerActionListener(NewClass.this));
cannot find symbol
symbol: class TimerActionListener
location: class NewClass
The compiler can not find the definition for the TimerActionListener class. Where is it defined?cannot find symbol
symbol: class TimerActionListener
If you don't understand my answer, don't ignore it, ask a question.
this is where i have added but im not sure if this is correct
Last edited by stresstedout; April 10th, 2014 at 07:33 PM.
The compiler will tell you. If there are no errors, then it could be correct.not sure if this is correct
If you don't understand my answer, don't ignore it, ask a question.
this is the compiler error
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type: <any>
at javaapplication24.NewClass.<init>(NewClass.java:24 )
at javaapplication24.NewClass.main(NewClass.java:73)
Java Result: 1
line 24 isjavax.swing.Timer myTimer = new javax.swing.Timer(1000, new TimerActionListener(NewClass.this));
Last edited by stresstedout; April 10th, 2014 at 07:08 PM.
Sorry, I don't know about your IDE's error messages.
If you don't understand my answer, don't ignore it, ask a question.
can you tell me why this is
cannot find symbol
symbol: class TimerActionListener
location: class NewClass
Last edited by stresstedout; April 10th, 2014 at 07:32 PM.
The formatting of the code is bad enough that it is hard to see where methods begin and end.
The missing class's definition must be out of scope for where it is referenced. Try moving its definition so it is in scope where it is referenced.
If you don't understand my answer, don't ignore it, ask a question.
what should the method look like?
What method?
If you don't understand my answer, don't ignore it, ask a question.