JBotSim icon indicating copy to clipboard operation
JBotSim copied to clipboard

How to stop a clock?

Open EmperoR1127 opened this issue 5 years ago • 4 comments

Hi,

I'm wondering why there isn't a stop() method in class Topology? How do I jump out of the code tp.start()?

EmperoR1127 avatar Aug 03 '20 00:08 EmperoR1127

Hi @EmperoR1127,

There is a tp.pause() / tp.resume() mechanism that seems to do what you need. If it does not, let us know.

acasteigts avatar Aug 03 '20 12:08 acasteigts

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?

EmperoR1127 avatar Aug 03 '20 13:08 EmperoR1127

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);

acasteigts avatar Aug 04 '20 12:08 acasteigts

Sure, I can use exit() for now. Thanks for your answer.

EmperoR1127 avatar Aug 04 '20 13:08 EmperoR1127