http://www.um.es/fem/EjsWiki/Main/ExamplesMultipleCollisions by Francisco Esquembre is possibly a suitable example for u to study and discuss on.

/htdocs/ntnujava/ejsuser/14019/users/sgeducation/lookang/MultipleCollisions_pkg/MultipleCollisions.propertiesFull screen applet or Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(875.9kB):double click downloaded file to run it. (14 times by 11 users) , Download EJS source (8 times by 6 users) View EJS source