//import coco.*;
import java.io.*;
import java.awt.*;

/*page designers may write codes such as this*/
class GenerateExampleCocoPage{
  public static void main(String[] argv){
    /*tabula rasa*/
    CocoPage cp=new CocoPage();

    /*layout*/
    cp.setLayout(new BorderLayout());

    /*add coco component*/
    CocoLog cl=new CocoLog();
    cl.setCocoId("LOG01");
    cl.setState("");
    cp.add(cl,"North");

    /*add form component*/
    TextField tf=new TextField(40);
    cp.add(tf,"Center");

    /*add a submit button; actionlistener remains unset until page is
      downloaded*/
    CocoSubmitButton b=new CocoSubmitButton();
    b.setLabel("Send It"); //look
    b.setCocoAddressee("LOG01"); //addressee
    cp.add(b,"East"); //to the page

    //include the whole form
    b.addParameter(tf);
  
    /*write the page to a file; designer will upload this file to the
      coco page server*/
    try{
      cp.dump("index.cjd");
    }catch(IOException x){
      System.out.println("Error dumping generated page.\n"+x.toString());
    }
  }
}
