import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
   This class creates a user interface part for the Go!
   Online Internet game.
   The user interface is composed of three parts: the upPanel,
   boardPanel, and downPanel.
   @author Sugiharto Widjaja
   @version November 20 2001
   */

public class UserInterface extends JFrame
{
   private static final String title = "Go! Online Internet Game";
   private static final int height = 560;
   private static final int width = 700;

   /**
         Create the components of the user interface part. The interface
         part created are the menubar, UpPanel, BoardPanel, and DownPanel
         panels. These panels will be able to communicate to the others.
         These panels will be added to the JFrame.
         @param none
         <dt><b>Postcondition:</b><dd>
         UpPanel, BoardPanel, and DownPanel panels are added to the
         JFrame
      */

   public UserInterface()
   {
      setTitle(title);
      setSize(width, height);
      // Adding the menubar
      JMenuBar mbar = new JMenuBar();
      setJMenuBar(mbar);
      // Creating the needed panels
      UpPanel up = new UpPanel();
      DownPanel down = new DownPanel(mbar);
      BoardPanel image = new BoardPanel();
      // Establishing communication between panels
      down.addUpPanel(up);
      down.addBoardPanel(image);
      up.addDownPanel(down);
      up.addBoardPanel(image);
      image.addDownPanel(down);
      image.addUpPanel(up);
      // Adding the panels to the JFrame
      Container contentPane = getContentPane();
      contentPane.add(up, BorderLayout.NORTH);
      contentPane.add(image, BorderLayout.CENTER);
      contentPane.add(down, BorderLayout.EAST);
   }
}

