The above simulation was generated with EJS.
There is another verison of [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=4.0]2D Collision[/url] , you can download the file and find out the original java code (written with JDK1.0.2).