NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Swing Timer will not work in Netbeans

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers
View previous topic :: View next topic  
Author Message
capt_nemo



Joined: 15 Feb 2012
Posts: 7

PostPosted: Fri Mar 02, 2012 6:47 pm    Post subject: Swing Timer will not work in Netbeans Reply with quote

I am working on creating a program on top of the netbeans platform and I am wanting to create a flashing icon in a label to draw the users attention to it. To accomplish this I have been trying to use the javax.swing.Timer to assist in this process. Which I have either A) created an ActionListener with the actionPreformed ActionEvent to pass to the Timer I create with how long to count for. Or B) I created an inner class that impliments ActionListener with the actionPerformed ActionEvent in it. And neither way works because either netbeans will flag the code with several different errors ( most listed below ) or if the code has no flags and I go and type in the name of the Timer and put the period to type start(); it will say that it doesn't exist. And also when I put the period beside the timer name I created it will show the code completion of “new”. Now I didn't write down all the errors, but the main ones are listed below, but I know it isn't anything that I am doing because I have even cut and pasted oracles timer example into the module I am working on and it does the same thing to it. I have all the imports needed as well. I also tried other peoples code that they say works, and again, it doesn't. And I just don't know what else to do because all the knowledge I know says it should be working, all the articles I have read says it should be working, yet netbeans says it doesn't for one reason or another.

errors I have received:
#1) when I type t.start(); to start the timer I created Timer t = new Timer(500, ImageListener); netbeans will flag it and says ( package timer does not exist <identifier> expected )
#2) netbeans will flag Timer t = new Timer(1000, ImageListener ); as an illegal forward reference
#3) I can not figure out how I did it or the exact message, but I also get a flags that will say there is no field and would I like it to create it and that there is no import for that class when the class is inside the module itself.

For reference these are a few of the links to the code examples I cut and pasted to test and got the same errors with as I got with my own code:

http://docs.oracle.com/javase/6/docs/api/javax/swing/Timer.html
http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html
http://www.leepoint.net/notes-java/other/10time/20timer.html
http://stackoverflow.com/questions/1006611/java-swing-timer
http://java.sun.com/products/jfc/tsc/articles/timer/

And if it makes any difference, I have the newest version of netbeans and it is up to date.
Back to top
capt_nemo



Joined: 15 Feb 2012
Posts: 7

PostPosted: Mon Mar 05, 2012 12:59 am    Post subject: Reply with quote

No one needs to reply to this, I found the solution on my own.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo