@Override
    public void run() {
    	try{
        while (true) {
        	// do nothing while we haven't started
        	while(!p.start)
        	{
        		Thread.sleep(10);
        	}
        	// while we're started, do your thing.
            while (p.start) {
				split.requestFocus();
				world.step();

				// causes a refresh
				viewer.repaint();
				// sleep for repaint
				Thread.sleep(50);
           }
    	}
        } catch (InterruptedException e) {
    		e.printStackTrace();
    	}
    }