Display all nodes in a branchgroup

How Do I display the list of nodes and their properties that are in a branchgroup
javacrawfishAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
Enumeration i = branchgroup.getAllChildren();
while (i.hasNextElement())
{
   Node n = (Node) i.nextElement();
   // display as required
}
0
 
javacrawfishAuthor Commented:
Getting:

PickTest.java:406: cannot resolve symbol
symbol  : method hasNextElement ()
location: interface java.util.Enumeration
        while (i.hasNextElement())
                ^
1 error
0
 
objectsCommented:
sorry that should have been

while (i.hasMoreElements())
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
javacrawfishAuthor Commented:
Do you know how to set a name to a node (i.e. Box1, Box2, Cone1, .et ) so when I search thur the nodes I get the name?
0
 
objectsCommented:
you could user the user data attribute
0
 
javacrawfishAuthor Commented:

What I trying to do is let a user add images,text, etc  to a java3d world and then list the objects in the complete universe by a user provided name.

So what would be the statement to assign the "user data attribute" to, I assume I could read this info for the enumration.

Shape3D textObject = new Text2D("Rotating Yellow Text",new Color3f(1f, 1f, 0f),"Serif",60,Font.BOLD);
pbjTrans.addChild(textObject);


Thanks for the extra help.
0
 
objectsCommented:
node.setUserData(nodename);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.