0

Recently I experienced that is a Robot instance is created already and if try to create it again (obviously without calling robot.cleanUp()) it hangs there forever. I investigated this and got to know that it takes a ScreenLock every time we create a Robot instance.

So my question is this kind of behaviour can be achieved by Singleton class. Then why we are allowed to create another Robot instance although it is a deadlock situation. I mean if I am to Create Robot, clean it up and create again then why should I clean and recreate it in the first place? There should be one API which will provide Robot instance upon user request because current approach does not make sense.

1 Answers1

0

But, there is a constructor new Robot(GraphicsDevice screen), which creates a Robot instance with coordinate system relative to this screen. For this purpose it make sense to have multiple instances of Robot.

Krzysztof Cichocki
  • 6,294
  • 1
  • 16
  • 32