JBotSim
JBotSim copied to clipboard
How to stop a clock?
Hi,
I'm wondering why there isn't a stop() method in class Topology? How do I jump out of the code tp.start()?
Hi @EmperoR1127,
There is a tp.pause() / tp.resume() mechanism that seems to do what you need. If it does not, let us know.
Hi @EmperoR1127,
There is a
tp.pause()/tp.resume()mechanism that seems to do what you need. If it does not, let us know.
Hi @acasteigts The problem is that the program (main() method) can't exit if I use tp.pause(). Do you know how to exit the program?
OK I see... you must be using JBotSim without GUI. Historically, the clock was accessible through the API. We've changed the clock system to make it compatible with various framework (No GUI, Swing GUI, FX GUI, ...). I was under the impression that we could still get a handle on the clock, but this seems to be missing indeed! Definitely, this is something we should fix, thanks for reporting this issue (now tagged as a bug).
In the meantime, if this is acceptable to you, you can still exit in the harsh way, using System.exit(0);
Sure, I can use exit() for now. Thanks for your answer.