java - Why is this string timer for delaying not working? -
so have string timer
import javax.swing.timer; import java.awt.event.*; public class delay implements actionlistener { public void delay(int time) { timer t = new timer(500, this); t.start(); } @override public void actionperformed(actionevent e) { } }
delays 500 ms (there no action performed), however, when call it
delay d = new delay(); for(char c : dialogue.tochararray()){ g2.drawstring(string.valueof(c),x,y); d.delay(5000); //here delay x += 10; if (x > 90){ x = 75; y = y + 20; } }
there no delay between writing letters. why this? thank you!
Comments
Post a Comment