// A program which registers tViewOne and tViewTwo as viewers of tModel.
// Barry Cornelius, 19 June 2000
import java.awt.    BorderLayout;
import java.io.     BufferedReader;
import java.awt.    Container;
import java.io.     InputStreamReader;
import java.io.     IOException;
import javax.swing. JLabel;
import javax.swing. JFrame;
public class MVCProg
{
   public static void main(final String[] pArgs) throws IOException
   {
      final Model tModel = new Model();
      final ViewOne tViewOne = new ViewOne();
      tModel.addObserver(tViewOne);
      final ViewTwo tViewTwo = new ViewTwo();
      tModel.addObserver(tViewTwo);
      final JLabel tJLabel = tViewTwo.getGUI();
      final JFrame tJFrame = new JFrame("MVCProg");
      final Container tContentPane = tJFrame.getContentPane();
      tContentPane.add(tJLabel, BorderLayout.NORTH);
      tJFrame.pack();
      tJFrame.setVisible(true);
      final BufferedReader tKeyboard =
                    new BufferedReader(new InputStreamReader(System.in));
      while (true)
      {
         System.out.print("Type in an int: ");
         System.out.flush();
         final String tLine = tKeyboard.readLine();
         if (tLine.equals(""))
         {
            break;
         }
         final int tNewValue = Integer.parseInt(tLine);
         tModel.set(tNewValue);
      }
      System.exit(0);
   }
}
