The above simulation was created more than 10 years ago with JDK1.0.2.

add("North",p);
means add p element to the north side of current Panel (another GUI element).

I would suggest you understand the physics model in the code.
I would suggest you study how to create GUI in java or use EJS to generate GUI for you if you want to create another by yourself!