Posted By:
Gustaf_Haag
Posted On:
Wednesday, December 8, 2004 08:58 AM
public void change(int number) { try {Thread.sleep(300);} catch (InterruptedException e) {} mybutton[number].setIcon(down[number]); try {Thread.sleep(500);} catch (InterruptedException e) {} mybutton[number].setIcon(up[number]); } When i call this method from my Contructor it works fine, but when i call it from Actionperformed, it won't sleep! I found out that when i call it and it works the thread's name is "Thread[main,5,main]", but when i call it from actionperformed it's "Thread[AWT-EventQueue-o,6,main]". What i want to do: Have one
More>>
public void change(int number)
{
try {Thread.sleep(300);} catch (InterruptedException e) {}
mybutton[number].setIcon(down[number]);
try {Thread.sleep(500);} catch (InterruptedException e) {}
mybutton[number].setIcon(up[number]);
}
When i call this method from my Contructor it works fine, but when i call it
from Actionperformed, it won't sleep!
I found out that when i call it and it works the thread's name is
"Thread[main,5,main]", but when i call it from actionperformed it's
"Thread[AWT-EventQueue-o,6,main]".
What i want to do:
Have one of my JButtons change ImageIcon for 0,5 seconds
when i press on it!
The Problem:
The thread won't sleep when i call it from actionperformed.
//Gustaf
Ps. I have no such things like "Run()" or "new Thread" or something like that in my code.
<<Less