import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.SwingUtilities; import javax.swing.Timer; /* * TimerTest38499.java * * Created on 20. leden 2004, 11:08 */ /** * * @author nenik */ public class TimerTest38499 { /** Creates a new instance of TimerTest38499 */ public TimerTest38499() { } static Timer t1 = new Timer(1, new R2()); static Timer t2 = new Timer(1, new R2()); static Timer t3 = new Timer(1, new R2()); static Timer t4 = new Timer(1, new R2()); static Timer t5 = new Timer(1, new R2()); static int cnt = 1; /** * @param args the command line arguments */ public static void main(String[] args) { // SwingUtilities t1.start(); t2.start(); t3.start(); t4.start(); t5.start(); R1 run = new R1(); for (int i=1; i<1000; i++) { SwingUtilities.invokeLater(run); try { Thread.sleep(1); } catch (InterruptedException e) { System.err.println("e:" + e); } } System.exit(0); } private static class R1 implements Runnable { public void run() { t1.restart(); t2.restart(); t3.restart(); t4.restart(); t5.restart(); System.out.print("x"); if (cnt++ % 80 == 0) System.out.println(); } } private static class R2 implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.print("."); if (cnt++ % 80 == 0) System.out.println(); } } }