Options(SmallWorld sw, GUICanvas cv, MenuItem mi) {
	
		smallWorld = sw;
		menuItem = mi;
		canvas = cv;
		
                // Set up layout.
                
		setSize(300,650);
		gridBag = new GridBagLayout();
		setLayout(gridBag);
		c = new GridBagConstraints();
 
		c.anchor = GridBagConstraints.SOUTHWEST;
		c.insets = new Insets(5, 5, 5, 5); 
		c.ipadx = 2;
		c.ipady = 2;
		c.fill = GridBagConstraints.HORIZONTAL;
		
		c.gridx = 0;
		c.gridy = 0;
		c.gridwidth = 1;
		c.gridheight = 1;
		agentsField = new TextField("10",10); 
		gridBag.setConstraints(agentsField, c);
		add(agentsField);

 
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		Label label = new Label("Number of Ring World Agents");
		gridBag.setConstraints(label, c);
		add(label);
                
                
                c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		widthField = new TextField("300",10); 
		gridBag.setConstraints(widthField, c);
		add(widthField);

                
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Width of field"); 
		gridBag.setConstraints(label, c);
		add(label);

                
                c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		heightField = new TextField("400",10); 
		gridBag.setConstraints(heightField, c);
		add(heightField);

 		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Height of field"); 
		gridBag.setConstraints(label, c);
		add(label);           
 
                
                c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		runsField = new TextField("10",10); 
		gridBag.setConstraints(runsField, c);
		add(runsField);

               
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Number of iterations"); 
		gridBag.setConstraints(label, c);
		add(label);
                
                
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		kField = new TextField("4.0",10); 
		gridBag.setConstraints(kField, c);
		add(kField);

 
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Value of k"); 
		gridBag.setConstraints(label, c);
		add(label);


		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		alphaField = new TextField("15.0",10); 
		gridBag.setConstraints(alphaField, c);
		add(alphaField);

 
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Value of alpha"); 
		gridBag.setConstraints(label, c);
		add(label);
		
		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		constantField = new TextField("0.0000000001",10); 
		gridBag.setConstraints(constantField, c);
		add(constantField);

 
		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Value of constant"); 
		gridBag.setConstraints(label, c);
		add(label);
		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		redAgent = new Scrollbar(Scrollbar.HORIZONTAL, 255, 1, 0, 255);
		gridBag.setConstraints(redAgent, c);
		add(redAgent);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Red level for Agents");
		gridBag.setConstraints(label, c);
		add(label);
		

		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		greenAgent = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
		gridBag.setConstraints(greenAgent, c);
		add(greenAgent);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Green level for Agents");
		gridBag.setConstraints(label, c);
		add(label);
		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		blueAgent = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
		gridBag.setConstraints(blueAgent, c);
		add(blueAgent);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Blue level for Agents");
		gridBag.setConstraints(label, c);
		add(label);
		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		redLine = new Scrollbar(Scrollbar.HORIZONTAL, 125, 1, 0, 255);
		gridBag.setConstraints(redLine, c);
		add(redLine);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Red level for lines");
		gridBag.setConstraints(label, c);
		add(label);
		

		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		greenLine = new Scrollbar(Scrollbar.HORIZONTAL, 125, 1, 0, 255);
		gridBag.setConstraints(greenLine, c);
		add(greenLine);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Green level for lines");
		gridBag.setConstraints(label, c);
		add(label);
		
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		blueLine = new Scrollbar(Scrollbar.HORIZONTAL, 125, 1, 0, 255);
		gridBag.setConstraints(blueLine, c);
		add(blueLine);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		label = new Label("Blue level for lines");
		gridBag.setConstraints(label, c);
		add(label);
	
                cbg = new CheckboxGroup();
                
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 2;
		c.gridheight = 1;
		colour = new Checkbox("Use scrollbars to colour", cbg, true);
		gridBag.setConstraints(colour, c);
		add(colour);
		
                c.gridx = 0;
		c.gridy++;
		c.gridwidth = 2;
		c.gridheight = 1;
		random = new Checkbox("Use random colours", cbg, false);
		gridBag.setConstraints(random, c);
		add(random);
                
                c.gridx = 0;
		c.gridy++;
		c.gridwidth = 2;
		c.gridheight = 1;
		values = new Checkbox("Use agent values to colour", cbg, false);
		gridBag.setConstraints(values, c);
		add(values);
                
		c.gridx = 0;
		c.gridy++;
		c.gridwidth = 1;
		c.gridheight = 1;
		ok = new Button("Ok");
		gridBag.setConstraints(ok, c);
		ok.addActionListener(this);
		add(ok);

		c.gridx = 1;
		c.gridwidth = 1;
		c.gridheight = 1;
		cancel = new Button("Cancel");
		gridBag.setConstraints(cancel, c);
		cancel.addActionListener(this);
		add(cancel);
		
		addWindowListener(new WindowAdapter(){
		    public void windowClosing(WindowEvent e) {
			setVisible(false); 
		    }
		});
	
	} // End of constructor.