import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/**
   The GUI part for the server side
   @author Sugiharto Widjaja
   @version 09/21/02
*/
public class ServerPanel extends JPanel
{
   /**
      Construct the GUI components
   */
   public ServerPanel()
   {
      setLayout(new BorderLayout());
      fText = new JTextArea(ROW,COL);
      fText.setEditable(false);
      JScrollPane pane = new JScrollPane(fText);
      JButton quit = new JButton("Quit");
      quit.addActionListener(new
         ActionListener()
         {
            public void actionPerformed(ActionEvent e)
            {
               killServer();
            }
         });
      JPanel pane1 = new JPanel();
      pane1.add(pane);
      JPanel pane2 = new JPanel();
      pane2.add(quit);
      add(pane1, BorderLayout.CENTER);
      add(pane2, BorderLayout.SOUTH);
      timeServer = new TimeZoneServer(fText);
      timeServer.enableService();
   }

   /**
      disconnect the server and exit the program
   */
   public void killServer()
   {
      timeServer = null;
      System.exit(0);
   }

   // The number of rows of the text area
   private static final int ROW = 40;
   // The number of columns of the text area
   private static final int COL = 60;
   // The timezone server
   private TimeZoneServer timeServer;
   // The text area
   private JTextArea fText;
}

