Programming and Problem Solving with Java

(やまだぃちぅ) #1

CASE STUDY


676


add(button);
add(outLabel);

// Generate the array of integers
generateValues(SIZE);
setLayout(newGridLayout( 4 , 1 ));
}
}

14.4 Testing and Debugging


Testing an applet is much like testing an application. Because an applet is usually much
smaller, however, there is less code to test. In contrast, the steps involved in getting an ap-
plet to run are more involved because you have to set up a Web page.

Testing and Debugging Hints

1.Be sure that all of your initialization is within the initmethod.
2.An applet is often its own event listener. In such a case, confirm that the
addActionListenermethod has thisas its argument.
3.The spelling of the file name in the viewer or Web page must be identical to
the name of the file containing the Bytecode version of the applet.
Free download pdf