Clay Shell Version 5

Version 5 of the Clay Shell program is like the fourth version except that it contains dead buttons in a border layout.

Demos

java -jar ".../Clay5.jar" -s small -c random

Code

package clay5;

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);
        addComponents();
        setVisible(true);
        addWindowListener(new CloseWindow());
    }
    
    private void addComponents()
    {
        // establish the layout manager
        setLayout(new BorderLayout());
        // create five buttons
        Button nb = new Button("North");
        Button sb = new Button("South");
        Button eb = new Button("East");
        Button wb = new Button("West");
        Button cb = new Button("Center");
        // add the buttons to the frame
        add(nb,BorderLayout.NORTH);
        add(sb,BorderLayout.SOUTH);
        add(cb,BorderLayout.CENTER);
        add(eb,BorderLayout.EAST);
        add(wb,BorderLayout.WEST);
    }

    class CloseWindow extends WindowAdapter {

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

    }

}

Questions

  1. What is different between this version of the program and the previous one. (Identify all the differences in the code.)
  2. What is a layout manager?
  3. What is a container, and where does it fit in the Java class hierarchy?
  4. What are some common types of layout manager?
  5. How does a border layout manager do its job?
  6. What is a button?
  7. What is a component?
  8. In what class is the setLayout method defined?
  9. In what class is the add method defined?
  10. Why are the buttons dead?