/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
*                                                                     *
* \                                                                   *
*  |- <applet code="MagPuz.class" width="550" height="315"></applet>  *
* /                                                                   *
* \                                                                   *
*  |- MagPuz.java                                                     *
*  |-  This applet is meant to introduce people to the magic          *
*  |-  square problem, in which you try to get the same sum along     *
*  |-  the rows, columns, and diagonals of a matrix of numbers.       *
* /                                                                   *
* \                                                                   *
*  |- Author: Mike Morton                                             *
*  |- Created: Summer 1996                                            *
* /                                                                   *
* \                                                                   *
*  |- Revised on: 12/02/03                                            *
*  |- by Pavel Safronov                                               *
* /                                                                   *
* \                                                                   *
*  |- Last updated: 1/22/04                                           *
*  |- by Michael McKelvey                                             *
* /                                                                   *
*                                                                     *
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Label;

public class MagPuz extends java.applet.Applet {

  MagCan magcan;
  MagControls magcontrols;

  public void init() {

    //Make the 2 main Frames
    magcan = new MagCan(this);
    magcontrols = new MagControls(this);

    //Set Layout FOR 2 Frames
/// Commented out by MLM (1/15/04)
///    this.setLayout(new GridLayout(2,1,10,10));
    this.setLayout(new BorderLayout());


    //Add Panels
/// Commented out by MLM (1/15/04)
///    add(magcan);
///    add(magcontrols);
    add(magcan, BorderLayout.CENTER); // or CENTER?
    add(magcontrols, BorderLayout.SOUTH);
  }

  //This Function handles the update of colors from the Control Frame.
  //Hopefully this function is self-evident.
  void update_jamcolor(String choice, String col) {
    Color theColor = Color.black;

    if (col.equals("Blue")) theColor = Color.blue;
    else if (col.equals("Red")) theColor = Color.red;
    else if (col.equals("Green")) theColor = Color.green;
    else if (col.equals("Black")) theColor = Color.black;
    else if (col.equals("White")) theColor = Color.white;

    magcan.updatecolor(choice, theColor);
  }

}





