private void destroyView() { // check if a scene thread still exists if (view != null) { // stop the animation thread (stop waits until the thread is finished) view.stop(); // release the thread (For collection) view = null; } }
public void initialize() { // lock for thread safety lock (lockView) { // check the view (thread) already exists, stop and clear the old one. destroyView(); // view = new EmptyView(50, 0, 0, 800, 600, false); // start the scene thread //if (view != null) view.start(); view.start(); } }