|
|
|
This exercise produces an application rather than an applet. This application should be run from the command line rather than from a page in a browser. (Applets cannot do file I/O for security reasons.) Open a
Skeleton Code
Tasks
Create class
Add the following code to
import java.awt.event.*;
...
// handle the WINDOW events here
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
setVisible(false);
dispose();
System.exit(0);
}
});
Add an
Where help exists, the task numbers above are linked to the step-by-step help page. Solution Source
Demonstration
This program cannot be run as an applet as it uses file I/O. Please run the solution from the command line as an application, or from an IDE window.
Next ExerciseExercisesShort CourseCopyright 1996-2000 jGuru.com. All Rights Reserved. |