Slide 11 of 13
Notes:
Lines 43 to 60 defines the graphics plotting using the paint method.
Line 44 derives the applet size from the .htm calling program and assigns the pixel values to variables d.width and d.height respectively.
Lines 45 to 48 use the graphics library definitions to draw the applet and plot outline rectangles, set drawing colours and draw the plot x-axis.
Lines 50 to 59 plots the sine math function using a ‘for’ loop to increment pixel values along the x-axis and to draw a line between the function values until the end of the plot window.
Line 52 defines the math sine function with amplitude ‘amp’ from the scrollbar setting. The offset is 150 pixels from the applet edge.