wood burning stoves
The moose likes Java Micro Edition and the fly likes wait and then change the picture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "wait and then change the picture" Watch "wait and then change the picture" New topic

wait and then change the picture

Jude Fawly
Ranch Hand

Joined: Dec 01, 2004
Posts: 33
Hello there,

consider i have an image on the canvas. i want the user when he clicks 2 on the keypad for example, i want the canvas to wait for about one second and then change the the image. I tried using Thread.sleep(1000) and then changing the picture reference and then calling repaint() method. But here i get a problem, the canvas always changes the picture and gets repainted and then gets idle for one second. In java stand edition, i use to use timers and calling it everytime "start and stop", but in J2ME i read that the timer won't work properly when called sequentially.

can somebody help me?

Teach me to die that so I may<br />Rise glorious at the awful day
Svend Rost
Ranch Hand

Joined: Oct 23, 2002
Posts: 904

A hack would be to introduce a state value. In the block, that gets
excecuted when the user presses "2" you'll sleep for 1000 ms, then
change the state.

Do report back if the above doesn't work, or is a bad approach

/Svend Rost
I agree. Here's the link: http://aspose.com/file-tools
subject: wait and then change the picture
It's not a secret anymore!