Voila, je me demande si le Timer de javax.swing attends d'avoir terminé l'execution de son ActionEvent avant avant de déclencher le suivant...
sur java.sun.com je penses avoir trouvé un réponse, mais je ne suis pas sur d'avoir tout compris:
Citation :
Although all Timers perform their waiting using a single, shared thread (created by the first Timer object that executes), the action event handlers for Timers execute on another thread -- the event-dispatching thread. This means that the action handlers for Timers can safely perform operations on Swing components. However, it also means that the handlers must execute quickly to keep the GUI responsive.
|
Voila mon code:
en fait j'attends qu'il termine l'execution de l'actionEvent avant d'en continuer un autre grâce au booléen affTermine
Code :
- timer = new javax.swing.Timer(delay, new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- if (affTermine)
- {
- affTermine = false;
- champ.MAJ();
- for (int i=0; i < 500000; i++) // ça c pour le faire ramer un peu :)
- {
- repaint();
- }
- affTermine = true;
- }
- }
- });
- timer.start();
|
Donc voila, ai-je besoin de reccourir à cette technique ou pas ?
Merci pour vos réponses 
Message édité par Sylfurd le 26-05-2004 à 11:13:18