public synchronized void step() {
   EventPoint eventpoint = Events.pop();
   if (eventpoint != null) {
     XPos = Math.max(XPos, (int) eventpoint.x);
     eventpoint.action(this);
   } else if (XPos < getBounds().width) {
     XPos = getBounds().width;
   } else {
     init();
   }
   Arcs.checkBounds(this, XPos);
   repaint();
 }
  public synchronized boolean singlestep() {
    if (Events.Events == null || (double) XPos < Events.Events.x) XPos++;

    while (Events.Events != null && (double) XPos >= Events.Events.x) {
      EventPoint eventpoint = Events.pop();
      XPos = Math.max(XPos, (int) eventpoint.x);
      eventpoint.action(this);
      Arcs.checkBounds(this, XPos);
    }

    if (XPos > getBounds().width && Events.Events == null) Arcs.checkBounds(this, XPos);

    repaint();
    return Events.Events != null || XPos < 1000 + getBounds().width;
  }