When you add cube2 as a child of ball, it will do the same rotation as the ball. It's only natural that it changes its position according to the balls rotation. I'm still not really sure what exactly you want. The second slide looks like the first one to me except that the cube carries another number. Anyway, try something like
for (int i = 0 ; i<25;i++){
ball.rotateZ((float) ((2.0f / 25) * Math.PI));
cub = Primitives.getCube(1);
cub.setRotationMatrix(ball.getRotationMatrix().cloneMatrix());
cub.translate(?,?,?); // Position on top of ball, the same for each cub
cub.setRotationPivot(<position of ball's transformed center-cub's transformed center>);
}
That's untested...it might not work but maybe it's a starting point. I don't think that a child relation between cub and ball is what you want here.