i have two animation going on screen.
one animation is a rect going to right. i dont want this animation to stop
2nd animation is message coming on screen for 1 sec and removeing it.
right now 1st animation works fine but doesnt diplay. its be iam seting message="". but how can i display for 1 sec.
public class ... ... int x = 0; int y = 0; int dx = 1; String message = "hellow world"; ... public void start() { ... if(timer_class == null) { Timer timer_class = new Timer(10, this); } else { timer_class.stop(); } timer_class.start(); } public void actionPerformed(ActionEvent e) { x+=dx; //make 1st animation message = ""; repaint(); } public void paint(Graphics g) { g.drawRect(x,y,10,10); //i dont want this animation to stop if(!message.equal("")) //this should only come on screen for 1sec { g.drawString(message, 600, 200); } } }