I would like to incorporate both timers (.swing for gui and .util for small delays) in a program I'm creating. Is this possible, or can I use one to do the work of the other?
Thanks for any help.
Printable View
I would like to incorporate both timers (.swing for gui and .util for small delays) in a program I'm creating. Is this possible, or can I use one to do the work of the other?
Thanks for any help.
If you need to use both (can you explain what your problem is) you can.
An easy way would be to use the full package path when defining the objects vs using import statements.
I'm trying to make a basic top down shooter game (basically Galaga), so I already have a swing timer employed. I was trying to find ways to make a firing rate for the player ship, but when I was trying the util Timer it wouldn't compile.
In case it wasn't obvious, I'm rather inexperienced with programming, so if you can think of a better methodology I would appreciate it very much as well.
Have you tried the full package path when defining an object for the class?Quote:
it wouldn't compile.
From the doc:
What are your concerns in using timers?Quote:
java.util.Timer is more general and has more features. The javax.swing.Timer has two features that can make it a little easier to use with GUIs.
I haven't tried using the full package path as I'm not sure how to do that. As for my concerns with using timers, I have none; I've been really happy with what I've been able to do with them so far, so I was trying to do it again. What I meant by "if you can think of a better methodology" is that I'm sure if there were an easier or more efficient way to operate you could tell me about it.
Again, I appreciate any help you're willing to provide.
EDIT: I'm going to try the full package path thing now. Wish me luck