Need time waster code or something.
- From: Taunto <nope@xxxxxxxxx>
- Date: Sat, 29 Apr 2006 18:28:35 -0700
I'm trying to "flash" a button, by changing its icon from one color to another.
It works with the mouse events (on when clicked, off when released), but when I try to run the following code, I don't see a change. I see something happen to the button (the color square gets ever so slightly smaller), but the color doesn't change. If I comment out the code where it sets the color back off, it stays on, so I know its executing.
I'm assuming my for-loop wait mechanism is the problem, and might be going by so fast I can't see it. I've tried larger numbers and the same problem.
Is there a better wait mechanism?
public void flashButton()
{
button.setIcon(onIcon);
for (long i = 0; i < 1000000; i++)
{
}
button.setIcon(offIcon);
}
.
- Follow-Ups:
- Re: Need time waster code or something.
- From: Knute Johnson
- Re: Need time waster code or something.
- Prev by Date: Re: How to implement tab order?
- Next by Date: Re: Need time waster code or something.
- Previous by thread: gettting a wait()'ing thread to run again
- Next by thread: Re: Need time waster code or something.
- Index(es):