Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Help

 

Training Index

by jGuru

Exercise  API Docs  About This Short Course  Short Course  Exercises

Help is available for each task.

Task 1

Create class ColoredPanesAppl with nothing but a main() method that creates an instance of class ColoredPanesWindow, which you will create in the next task. Show that window.

Use setVisible(true) to make a Frame instance visible.

Task 2

Create class ColoredPanesWindow. Turn the applet init() into the constructor. Set the size to 100 x 100.

As an alternative, you could, of course, simply call the init() method from the constructor.

Task 3

Add window-closing event handling to ColoredPanesWindow so you can close the window.

You can do this with an anonymous class:

    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        setVisible(false);
        dispose();
        System.exit(0);
      }
    });

Copyright 1996-2000 jGuru.com. All Rights Reserved.