import java.awt.*;
import javax.swing.*;

public class Fig7_10
    extends Panel
{

    /**
     * Constructor.
     */
    public Fig7_10 () {
	super();
	setLayout(new BorderLayout());
	// Create new panels
	Panel top = new Panel();
	Panel middle = new Panel();
	Panel bottom = new Panel();
	// Set layouts of panels
	top.setLayout(new BorderLayout());
	middle.setLayout(new GridLayout(6, 7));
	bottom.setLayout(new GridLayout(1, 3));
	// Add calendar components
	// Top
	top.add(new JButton("Previous Month"), BorderLayout.WEST);
	JLabel month = new JLabel("October", JLabel.CENTER);
	top.add(month, BorderLayout.CENTER);
	top.add(new JButton("Next Month"), BorderLayout.EAST);
	add(top, BorderLayout.NORTH);
	// Middle
	// Add days names
	String days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
	for (int i=0; i<days.length; i++)
	    middle.add(new JButton(days[i]));
	// Add days
	for (int day=1; day<=31; day++)
	{
	    Integer Day = new Integer(day);
	    middle.add(new JButton(Day.toString()));
	}
	add(middle, BorderLayout.CENTER);
	// Bottom
	bottom.add(new JButton("Edit"));
	bottom.add(new JButton("Save"));
	bottom.add(new JButton("Quit"));
	add(bottom, BorderLayout.SOUTH);
    }

    public static void main(String args[]) {
	Frame f = new Frame("Exercise 7.3.1 c");
	Fig7_10 figure = new Fig7_10();
	f.add(figure, BorderLayout.CENTER);
	f.pack();
	f.show();
    }
}

