package visual.dynamic.described;

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;

import app.*;
//import gui.*;
import visual.*;
import visual.dynamic.described.Airplane;
import visual.dynamic.described.BuzzyOnMars;
import visual.dynamic.described.Stage;
import visual.statik.sampled.*;


/**
 * An example that illustrates the use of multiple views
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 *
 */
public class   PIPApp
       extends AbstractMultimediaApp
{
    /**
     * The entry point
     */
    public void init()
    {
       Airplane                      plane;
       BuzzyOnMars                   buzzy;
       Content                       mars;
       ContentFactory                factory;
       JPanel                        contentPane;       
       Stage                         stage1, stage2;
       VisualizationView             view1, view2;
       

       // The Stage for Buzzy
       stage1 = new Stage(50);
       stage1.setBackground(Color.white);
       stage1.setRestartTime(7000);
       view1 = stage1.getView();
       view1.setRenderer(new ScaledVisualizationRenderer(
                                view1.getRenderer(),
                                640.0, 480.0));       
       view1.setBounds(0,0,640,480);       

       factory = new ContentFactory();       
       mars = factory.createContent(
          "/visual/dynamic/described/mars.gif");
       stage1.add(mars);


       // Buzzy
       buzzy = new BuzzyOnMars();
       stage1.add(buzzy);


       // The stage for the airplane
       stage2 = new Stage(50);
       view2 = stage2.getView();
       view2.setRenderer(new ScaledVisualizationRenderer(
                                view2.getRenderer(),
                                640.0, 480.0));
       view2.setBounds(50,50,160,120);     
       view2.setSize(160,120);       
       view2.setBackground(Color.white);
       stage2.setRestartTime(12000);

       // The Airplane
       plane = new Airplane();
       stage2.add(plane);
       
       
       // The content pane
       contentPane = (JPanel)rootPaneContainer.getContentPane();
       contentPane.add(view2);
       contentPane.add(view1);
       
       stage1.start();
       stage2.start();
    }


}
