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

    // Place a panel with several labels in the centre of the
    // frame, and a control panel in the South.
    // Use the control panel to cycle through the cities.
public class CityFrame extends Frame {
    public CityFrame(){
        final int width = 350, height = 150;
        setSize(width,height);
        setBackground(Color.white);

        // The panel where the city names are to be shown.
        CityDeck deck = new CityDeck();
        add(deck,"Center");
        // Create the control panel. The deck will respond to
        // button presses.
        createControls(deck);
    }

        // Create a set of buttons in a panel.
    protected void createControls(ActionListener deck){
        Panel controlPanel = new Panel();
        // Strings associated with the control buttons.
        String controlStrings[] = {
            "First", "Next", "Last", "Random", "Quit",
        };
        for(int b = 0; b < controlStrings.length; b++){
            Button control = new Button(controlStrings[b]);
            control.setActionCommand(controlStrings[b]);
            control.addActionListener(deck);
            controlPanel.add(control);
        }
        add(controlPanel,"South");
    }
}
