Any number of balls (specified by a constant) will bounce around the screen, bouncing off of each other and the walls with perfectly elastic collisions. Uses a thread to control the balls and double buffering to repaint without flickering. The balls are randomly sized and colored and their mass depends on their size. (The theory behind collisions explained in collisions method of code.)
File List:
Billiards.java
15Kb
Similar code
Magnifier
(Popularity: ) : Magnifier lens that provides a way to enlarge items on the screen.
a 3d Shapes using math object
(Popularity: ) : This code generats nice 3d shapes using the Math.cos and Math.sin objects. i think every programmer should play with those, ... Bounce Ball - Project2
(Popularity: ) : Bounces 2 balls around the screen. Can be easily modified to allow more than 2 balls. The user can adjust ...