List of usage examples for javax.media.j3d SceneGraphObject getUserData
public Object getUserData()
From source file:SwingTest.java
/** * Removes a BranchGroup from the scene based on user data * //from ww w .ja va 2 s .c o m * @param name * the user data to look for */ protected void removeShape(String name) { try { java.util.Enumeration e = sceneBranchGroup.getAllChildren(); int index = 0; while (e.hasMoreElements() != false) { SceneGraphObject sgObject = (SceneGraphObject) e.nextElement(); Object userData = sgObject.getUserData(); if (userData instanceof String && ((String) userData).compareTo(name) == 0) { System.out.println("Removing: " + sgObject.getUserData()); sceneBranchGroup.removeChild(index); } index++; } } catch (Exception e) { // the scenegraph may not have yet been synchronized... } }