/*
	SpheresApplet.java
	by Richard Unger
	March 1998


	The Applet object... All the code starts here.
	When the SpheresApplet is run as an Application,
	a frame is opened for the applet and the applet
	run within the frame.
	
*/


import java.awt.*;
import java.applet.Applet;


public class SpheresApplet extends Applet implements CommandExecutor
{

// State & Settings variables
	private boolean asApplication;
	
// GUI elements
	private ControlPanel controls;
	private RoboCanvas viewPane;
	private CommandsPanel theCommPanel;
	
// Command Handling
	private CommandParser commands;

// Algorithmic variables
	private InteractivePointSet thePoints;


// Constructor code
// Lowest level initialization, let init() method handle most things

	public SpheresApplet(){
		this(false);
		}
		
	public SpheresApplet(boolean asApp){
		super();
		asApplication = asApp;
		setSize(600, 400);
		}


// init() method - set up our applet once we know it is ready to run...

	public void init() {
		// this should be most of the screen for small screens
		
		// create the user-interface
		if (asApplication)
			commands = new CommandParser();
		else
			commands = new CommandParser(this.getDocumentBase());
		theCommPanel = new CommandsPanel(asApplication,commands);
		commands.CommandParserInit(theCommPanel);
				
		controls = new ControlPanel(commands);
		controls.AddPanel("points",new PointsPanel(commands));
		controls.AddPanel("commands",theCommPanel);
		controls.AddPanel("graphs",new GraphsPanel(commands));

		viewPane = new RoboCanvas(commands);
		
		setLayout(new BorderLayout());
		add("North",controls);
		add("Center",viewPane);
				
		// create the algorithmic data structures & variables
		
		thePoints = new InteractivePointSet(commands,viewPane);
		viewPane.AddArtiste(thePoints);
		
	}

// start() - run our applet

	public void start(){
		setVisible(true);
		repaint();
		}
	
// redraw our applet

	public void paint( Graphics g ) {
		// nothing left to do, all our sub-components will paint themselves!
		super.paint(g);
	}


// handle commands

	public String performCommand(String theCommand){
		return null;
		}

}


/*

Supports the following commands:


*/