/*
	A basic extension of the java.applet.Applet class
 */

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

public class MainApplet extends Applet
{
	public void init()
	{
	
		// This code is automatically generated by Visual Cafe when you add
		// components to the visual environment. It instantiates and initializes
		// the components. To modify the code, only use code syntax that matches
		// what Visual Cafe can generate, or Visual Cafe may be unable to back
		// parse your Java file into its visual environment.
		//{{INIT_CONTROLS
		setLayout(null);
		setSize(900,480);
		dataPanel.setLayout(null);
		add(dataPanel);
		dataPanel.setBackground(java.awt.Color.lightGray);
		dataPanel.setBounds(200,0,700,480);
		label1.setText("?");
		dataPanel.add(label1);
		label1.setBounds(328,216,58,63);
		button1.setLabel("add Frame 1");
		add(button1);
		button1.setBackground(java.awt.Color.lightGray);
		button1.setBounds(0,0,108,24);
		button2.setLabel("add Frame 2");
		add(button2);
		button2.setBackground(java.awt.Color.lightGray);
		button2.setBounds(0,48,108,24);
		//}}
	
		//{{REGISTER_LISTENERS
		SymAction lSymAction = new SymAction();
		button1.addActionListener(lSymAction);
		button2.addActionListener(lSymAction);
		//}}
	}
	
	//{{DECLARE_CONTROLS
	java.awt.Panel dataPanel = new java.awt.Panel();
	java.awt.Label label1 = new java.awt.Label();
	java.awt.Button button1 = new java.awt.Button();
	java.awt.Button button2 = new java.awt.Button();
	//}}

	class SymAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == button1)
				button1_ActionPerformed(event);
			else if (object == button2)
				button2_ActionPerformed(event);
		}
	}

	void button1_ActionPerformed(java.awt.event.ActionEvent event)
	{
	    System.out.println( "button1" );
		Panel1 pnl = new Panel1();
		dataPanel.removeAll();
		dataPanel.add( pnl );
		pnl.repaint();
		pnl.validate();
	    dataPanel.validate();
	    
	}

	void button2_ActionPerformed(java.awt.event.ActionEvent event)
	{
	    System.out.println( "button2" );
		Panel2 pnl = new Panel2();
		dataPanel.removeAll();
		dataPanel.add( pnl );
		pnl.repaint();
		pnl.validate();
	    dataPanel.validate();
	}
}
