TreePath selectionPath = null;
// Add a node for each animation.
for (String animationName: sprite.getAnimationNames()) {
SpriteAnimation animation = sprite.getAnimation(animationName);
DefaultMutableTreeNode animationNode = createAnimationNode(animationName);
root.add(animationNode);
// Add a node for each direction of this animation.
for (int i = 0; i < animation.getNbDirections(); i++) {
DefaultMutableTreeNode directionNode = createDirectionNode(animationName, i);
animationNode.add(directionNode);
// Initially select the sprite's current animation and direction.
if (animationName.equals(sprite.getSelectedAnimationName()) &&