Ejs Open Source Newton's Cradle Java Applet by Fu-Kwun &  lookang, this version has best collision detection by Fu-Kwun.

this is a derived work based on Fu-Kwun Hwang's original Real Newton's Cradle here http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1976.msg7387#msg7387

this remixed was a necessary as it has better collision detection than my older remix here Ejs Open source Newton's Cradle java Applet by Paco customized by lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=824.0

Newton's cradle, named after Sir Isaac Newton, is a device that demonstrates conservation of momentum and energy via a series of swinging spheres.

Construction
A typical Newton's cradle consists of a series of identically sized metal balls suspended in a metal frame so that they are just [color=red][b]NOT[/b][/color] touching each other at rest. Each ball is attached to the frame by two wires of equal length angled away from each other. This restricts the pendulums' movements to the same plane. [img]http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Newtons_cradle_animation_book_2.gif/200px-Newtons_cradle_animation_book_2.gif[/img]

Action
If the first one ball on the left is pulled away and is let to fall, it strikes the second ball in the series and the the first ball comes to an almost dead stop. The ball on the opposite side of the series acquires the momentum of the first ball almost instantly and swings in an arc that one would expect of the first ball.

The intermediate balls appear almost stationary. What actually happens is that the first impact transfer momentum and kinetic energy from the first ball to the second. The second ball having the momentum and kinetic of the first ball now hits almost perfectly elastic with the third ball, transferring it's momentum and kinetic energy to the third ball in the series. This transfer of momentum and kinetic energy continues until the (n-1) and n ball, where finally the last ball n moves off with the momentum and kinetic energy of the first ball. Toward the end of oscillation, the intermediate balls are jiggling a bit.

Further intrigue is provided by starting more than one ball in motion. With two balls, exactly two balls on the opposite side swing out and back. While this is satisfyingly symmetrical, why could not one opposite ball swing out twice as fast, or four balls at half speed? Having the same number of balls swing on each side conserves both energy and momentum.

Further Physics
Newton's cradle is a clear visual example of the conservation of both momentum (mass x velocity) and kinetic energy (0.5 x mass x velocity^2) in a mechanical system. When the cradle only has two balls, these two principles are sufficient to specify its behaviour; i.e. there is no way of conserving momentum and energy when the first ball strikes the second other than for the first to stop and the second to move off at the same speed as the first.
For example, if the balls each have a mass of 1 and the first ball strikes the other two stationary balls with a velocity of 1, the initial momentum of the system is 1 x 1 = 1 and the kinetic energy is 0.5 x 1 x 1^2 = 0.5. If the first balls stops and the third ball moves off with a velocity of 1 (which is what actually happens), the momentum remains 1 and the kinetic energy remains 0.5.
However, if the first ball were to bounce backwards with a velocity of -1/3 and the second and third balls were to move forward each at a velocity of 2/3, the momentum would be 1 x (-1/3 + 2/3 + 2/3) = 1 and the kinetic energy 0.5 x 1 x ((-1/3)^2 + (2/3)^2 + (2/3)^2) = 0.5; i.e. this would also preserve both momentum and kinetic energy; however, it is not what happens.
The reason is because the collisions are actually with free individual balls and not with 2 connected-joint balls.
What actually happens is that the first impact transfer momentum and kinetic energy from the first ball to the second. The second ball having the momentum and kinetic of the first ball now hits almost perfectly elastic with the third ball, transferring it's momentum and kinetic energy to the third ball in the series. This transfer of momentum and kinetic energy continues until the (n-1) and n ball, where finally the last ball n moves off with the momentum and kinetic energy of the first ball. Toward the end of oscillation, the intermediate balls are jiggling a bit.

Applications
The most common application is that of a desktop executive toy. A less common use is as an educational aid, where a tutor explains what is happening or challenges students to do so.