public synchronized void pauseResumeSimulation() {
        if (step && !stop) {
            paused = true;
            try {
                synchronized (this) {
                    this.wait();
                }
            } catch (InterruptedException ex) {
                Logger.getLogger(Simulation.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            try {
                Thread.sleep(DELAY);
            } catch (InterruptedException l) {
            }
        }
    }