/*
 * 	You can add code anywhere in this file - except in the areas that are
 * 	written by the editor. You should not change the relative ordering of
 * 	the code. The constructor must precede the event handlers, which must
 * 	precede handleEvent(), and so on.
 * 	 
 * 	You may remove this comment block or replace it with another.
 */

import java.awt.*;
import java.util.*;
import java.io.*;
import java.net.*;
import asymetrix.viewer.*;

public class Form1 extends java.applet.Applet
{
	public void init()
	{
		// You may add code anywhere in this method.

		SuperCedeInit();   // Do not remove this line
	}

	protected void SendButtonClicked( Event event )
	{
		// Put event handler code here...
		TextField1EnterKeyPressed(event);
	}

	protected void TextField1EnterKeyPressed( Event event )
	{
		// Put event handler code here...
		SymCafeSpawnClient client=new SymCafeSpawnClient(textArea1,textField1);
		client.start();
	}

	public boolean handleEvent( Event event )
	{
		// Tests for custom events go here...
		return SuperCedeEvent( event );   // Do not remove this line
	}

	public static void main( String args[] )
	{
		AppletProperties properties = new AppletProperties();
		properties.put( "name", "Form1" );
		properties.put( "code", "Form1" );
		properties.put( "width", "100" );
		properties.put( "height", "100" );

		String name = "file:///e:/Development/Source/SClient/SClient/earl.html";
		URL url = null;
		try
		{
			url = new URL( name );
		}
		catch( MalformedURLException e )
		{
		}

		Application app = new Application();
		Viewer viewer = app.CreateViewer( null );
		viewer.CreateApplet( url, properties );
	}

// SuperCede Begin Initialization
// Do not remove the Begin and End markers.
// The editor will rewrite the contents of this section each time the form is saved.
	private void SuperCedeInit()
	{
		GridBagConstraints gbConstraints = new GridBagConstraints();
		GridBagLayout gridBag = new GridBagLayout();

		setLayout( gridBag );
		addNotify();
		resize( (insets().left + insets().right + 362), (insets().top + insets().bottom + 319) );

		SendButton = new Button( "Send" );
		gbConstraints.gridx = 1;
		gbConstraints.gridy = 0;
		gbConstraints.gridwidth = GridBagConstraints.RELATIVE;
		gbConstraints.gridheight = GridBagConstraints.RELATIVE;
		gbConstraints.ipadx = 0;
		gbConstraints.ipady = 0;
		gbConstraints.weightx = 1;
		gbConstraints.weighty = 1;
		gbConstraints.insets.top = 0;
		gbConstraints.insets.bottom = 0;
		gbConstraints.insets.left = 0;
		gbConstraints.insets.right = 0;
		gbConstraints.fill = GridBagConstraints.BOTH;
		gbConstraints.anchor = GridBagConstraints.EAST;
		gridBag.setConstraints( SendButton, gbConstraints );
		add( SendButton );
		SendButton.addNotify();
		SendButton.move( (insets().left + 254), (insets().top + 14) );
		SendButton.resize( SendButton.preferredSize() );

		textField1 = new TextField( "" );
		textField1.setEditable( true );
		gbConstraints.gridx = 0;
		gbConstraints.gridy = 0;
		gbConstraints.gridwidth = GridBagConstraints.RELATIVE;
		gbConstraints.gridheight = GridBagConstraints.RELATIVE;
		gbConstraints.ipadx = 0;
		gbConstraints.ipady = 0;
		gbConstraints.weightx = 4;
		gbConstraints.weighty = 1;
		gbConstraints.insets.top = 0;
		gbConstraints.insets.bottom = 0;
		gbConstraints.insets.left = 0;
		gbConstraints.insets.right = 0;
		gbConstraints.fill = GridBagConstraints.BOTH;
		gbConstraints.anchor = GridBagConstraints.WEST;
		gridBag.setConstraints( textField1, gbConstraints );
		add( textField1 );
		textField1.addNotify();
		textField1.move( (insets().left + 20), (insets().top + 12) );
		textField1.resize( textField1.preferredSize() );

		textArea1 = new TextArea( "" );
		textArea1.setEditable( false );
		gbConstraints.gridx = 0;
		gbConstraints.gridy = 1;
		gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
		gbConstraints.gridheight = GridBagConstraints.RELATIVE;
		gbConstraints.ipadx = 0;
		gbConstraints.ipady = 0;
		gbConstraints.weightx = 5;
		gbConstraints.weighty = 50;
		gbConstraints.insets.top = 0;
		gbConstraints.insets.bottom = 0;
		gbConstraints.insets.left = 0;
		gbConstraints.insets.right = 0;
		gbConstraints.fill = GridBagConstraints.BOTH;
		gbConstraints.anchor = GridBagConstraints.SOUTH;
		gridBag.setConstraints( textArea1, gbConstraints );
		add( textArea1 );
		textArea1.addNotify();
		textArea1.move( (insets().left + 20), (insets().top + 63) );
		textArea1.resize( textArea1.preferredSize() );

		super.init();
	}
// SuperCede End Initialization

// SuperCede Begin Events
// Do not remove the Begin and End markers.
// The editor will rewrite the contents of this section each time the form is saved.
	private boolean SuperCedeEvent( Event event )
	{
		if ((event.target == SendButton) && (event.id == Event.ACTION_EVENT))
		{
			SendButtonClicked( event );
			return true;
		}
		else
		if ((event.target == textField1) && (event.id == Event.ACTION_EVENT))
		{
			TextField1EnterKeyPressed( event );
			return true;
		}
		else
		return super.handleEvent( event );
	}
// SuperCede End Events

// SuperCede Begin Declarations
// Do not remove the Begin and End markers.
// The editor will rewrite the contents of this section each time the form is saved.
	Button SendButton;
	TextField textField1;
	TextArea textArea1;
// SuperCede End Declarations
}


// SuperCede Begin Properties
// 1
// 44
// 2 "Untitled" 100000 0 400 0 F F F "MS Sans Serif"
// 1188 200 F 300 T 8388736 8421440 F T T T F F 0 0 0 0
// 0 16777215
// 0
// 0
// 9559 8440 0 0 2147483656 2147483653
// 1 5 0 0 "Form1" 0 0 0 2 2 0 T T F T
// ""
// F F F F F F F F F F F F
// 3
// {839BC52C-F563-11CF-B16F-0020AFDA72B7} 6707 9110 370 1164
//   "Send" T "SendButton" 0 2403 794 4 T T T T 0 16777215  "MS Sans Serif" 100000 0 400 0 F F F F F F F F F F F F F F F 1 0 -1 -1 T T 0 0 0 0 0 0 1 1 1
// {839BC52A-F563-11CF-B16F-0020AFDA72B7} 528 6205 318 1111
//   T F "" "textField1" 0 5677 794 4 T T T T 0 16777215  "MS Sans Serif" 100000 0 400 0 F F F F F F F F F F F F F F F 0 0 -1 -1 T T 0 0 0 0 0 0 8 4 1
// {839BC52B-F563-11CF-B16F-0020AFDA72B7} 528 9084 1667 5768
//   T "" "textArea1" 0 8556 4101 4 T T T T 0 16777215  "MS Sans Serif" 100000 0 400 0 F F F F F F F F F F F F F F F 0 1 -2 -1 T T 0 0 0 0 0 0 5 5 50
// 3 0 1 2
// SuperCede End Properties
