From the Java tutorial:
Note that the
Swingtimer’s task is performed in the event dispatch thread. This means that the task can safely manipulate components, but it also means that the task should execute quickly. If the task might take a while to execute, then consider using aSwingWorkerinstead of or in addition to the timer.
What does it mean by “quickly”? I mean that is not exact, less than a minute is quickly or what?
for example if I want to make an animation(1 minute) with some panels, via moving them, change their transparency and…and the user is just going to see the panels and is not going to work with them (no I/O), now is Timer a good idea for such situation ?
This means just that – it’s supposed to be fast, as in – little to no visible latency .
However, later in the page they say that if you have a complicated and concurrent application, look into the SwingWorker class and know about concurrency in regards to swing.
The concern is not necessarily how quickly everything runs, but that it’s in the correct order.
In SwingWorker, you’ll read that there are two main concerns in multi-threaded Swing apps: