Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

pause sleep thing

  Asked By: Joel    Date: Jul 27    Category: Java    Views: 579

I have a simulator, you can load a map, then press start and the simulator runs.

I've automated the process to autoload a map specified as an argument when the
native executable is called from a batch file. (In order to do lots of sim runs
with different seeds).

It works great but...

It takes a couple of seconds for the map to draw in the main frame after it has
been loaded. However, the run simulation method runs imediately after the map
has been loaded, and since i've got the program running in a while loop... it
uses both my processors at max speed and leaves no processing available to paint
the map, so the result is that although it runs really fast I can't see the
animation, even if i wanted to.

I was wondering if there was a way to delay the start process in some way, so
the map could load initially.

btw i saw a similar problem earlier where a sleep was put into the while loop
but I don't want to do this since I want the sim to run as fast as possible.