Clay Shell Version 4

Version 4 of the Clay Shell program is like the third version except that the frame can now be closed in the usual way!

Code

package clay4;

import java.awt.*;
import java.awt.event.*;

public class Main {

   <<<Just like in the previous version!>>>

}
    
class ClayFrame extends Frame {
    
    public ClayFrame(String title, Color color, Dimension size) {
        super(title);
        setBackground(color);
        setSize(size.width,size.height);
        setVisible(true);
        addWindowListener(new CloseWindow());
    }
    
    class CloseWindow extends WindowAdapter {
        public CloseWindow() {
        }
    
        public void windowClosing(WindowEvent event) {
            System.exit(0);
        }
    }

}

Questions

  1. What is different between this version of the program and the previous one. (Identify all the differences in the code.)
  2. Why is the line import java.awt.event.*; needed?
  3. Construct a narrative which describes how normal window closing is implemented in this program.
  4. Events?
  5. Adapter classes?