//*******************************************************************
//
//   Mimic_GUI.java          In Text          Definitions only
//
//   Authors:  Lewis and Loftus
//
//   Classes:  Mimic_GUI
//
//*******************************************************************

import java.awt.*;

//-------------------------------------------------------------------
//
//  Class Mimic_GUI represents the GUI for the Mimic applet.
//
//  Constructors:
//
//     public Mimic_GUI (Mimic mimic_applet)
//
//  Methods:
//
//     public void init()
//     public void update_label (String message)
//     public String get_quote()
//
//-------------------------------------------------------------------

class Mimic_GUI {

   private Label label = new Label ("No news is good news.");
   private TextField quote = new TextField(20);

   private Mimic applet;
   private Mimic_Action_Listener listener;

   //===========================================================
   //  Sets up the GUI by creating a listener object.
   //===========================================================
   public Mimic_GUI (Mimic mimic_applet) {
      applet = mimic_applet;
      listener = new Mimic_Action_Listener (applet);
   }  // constructor Mimic_GUI

   //===========================================================
   //  Adds the components to the GUI and the listener to the
   //  text field.
   //===========================================================
   public void init() {

      applet.add (quote);
      applet.add (label);

      applet.resize (250,100);

      // Add all associated listeners
      quote.addActionListener (listener);

   }  // method init

   //===========================================================
   //  Sets the text of the label.
   //===========================================================
   public void update_label (String message) {
      label.setText (message);
   }  // method update_label

   //===========================================================
   //  Retrieves the text from the text field.
   //===========================================================
   public String get_quote() {
      return quote.getText();
   }  // method get_quote

}  // class Mimic_GUI


