I guess the initial value for the distance d was set to 0.
And the applet will calculate new value and change displayed value when user drag it (several related values are changed,too.)
However, when you change the initial value to other value, but did not change the displayed String.
How to fix it:
method 1: change initial value for the display string.
method 2: add the function to be called when use drag the mouse to the initialization page.