swing - Delay between drawing of two icons in Java -
I have a piece of code in Java that draws 2 icons on the screen. I want to apply a delay between them, and I'm not sure about the best way.
At the moment I have;
cell.setIcon (image1); Thread.Sleep (500); // brevity cell 2. Try the neglected for the set icon (Image 2);
But it seems that either is dragged first, why is it so, and how can I fix it?
Assume that you are using swings, sleep can be done on the worker thread , Such as:
new swingworker & lt; Zero, zero> () {@Override protected Void doInBackground ()) Exception throws exception {Thread.sleep (500); Return tap; } @ Override protected zero () {cell2.setIcon (image2); }}. Execute ();
Comments
Post a Comment