First deag the box away from equilibrium point (horizontally). Then find out relations between the spring force and the displacement ...
VIEW or DOWNLOAD ejs xml source
then click to translate strings for selected locale.

Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop.
The purpose for this applet is for you to find out how easily to create a java simulation with "Easy Java Simulation". Click the following link to find out how it was created with EJS. (demonstration with flash) The model is : dvx/dt = -k*x/m You can change the model. For example change dvx/dt to (-k*x-0.1*vx)/m then you will have dampped oscillation. Try it and click the run button to generate new simulation for you in the ejs popup window.