import java.awt.*;
import java.net.*;

public class help extends Panel 
{
    asciiJam aj;

    public help(asciiJam ajam){ 
		this.aj = ajam;
		//this.setLayout(new GridLayout(7,1,0,4));
		this.setLayout(null);
    	this.resize(72,172);
    	this.setBackground(Color.gray);
    	this.setFont(new Font("Helvetica",Font.PLAIN,11));

		Button b = new Button("Tool Help");
		//b.setFont(new Font("Helvetica",Font.PLAIN,10));
		add(b);
		b.reshape(10,50,100,22);

		b = new Button("Connecting");
		//b.setFont(new Font("Helvetica",Font.PLAIN,10));
		b.reshape(10,80,100,22);
		add(b);

		b = new Button("Report Bug");
		//b.setFont(new Font("Helvetica",Font.PLAIN,10));
		b.reshape(10,110,100,22);
		add(b);

		b = new Button("Credits");
		//b.setFont(new Font("Helvetica",Font.PLAIN,10));
		b.reshape(10,140,100,22);
		add(b);


	/*
    	add(new Label("Rect Prefs"));
		CheckboxGroup group1 = new CheckboxGroup();
    	add(new Checkbox("Fill",group1,false));
    	add(new Checkbox("Outline",group1,true));
    	add(new Checkbox("Thin Line",group1,false));
    	add(new Label("Fill letter:"));
    	Panel p = new Panel();
    	p.setLayout(new FlowLayout(1,0,0));
    	TextField tf = new TextField(1);
    	tf.setText("X");
    	p.add(tf);
    	add(p);
    	add(new Button("Help"));*/
	}

    public boolean handleEvent(Event e){
	  if(e.target instanceof Panel){
			if(e.id==Event.MOUSE_ENTER)
				env.setCursor(env.DEFAULT_CURSOR,aj);
	  }
      else if(e.id==1001){
            try{ 
			if( (((Button)e.target).getLabel()).equals("Connecting")) {
	            System.out.println("loading "+env.helpConnectingURL);
				aj.getAppletContext().showDocument(new URL(env.helpConnectingURL),"_blank"); 
			}
			else if((((Button)e.target).getLabel()).equals("Report Bug")){
	            System.out.println("loading "+env.reportBugURL);
                aj.getAppletContext().showDocument(new URL(env.reportBugURL),"_blank"); 
			}
			else if((((Button)e.target).getLabel()).equals("Tool Help")){ 
	            System.out.println("loading "+env.toolHelpURL);
                aj.getAppletContext().showDocument(new URL(env.toolHelpURL),"_blank"); 
			}
			else if((((Button)e.target).getLabel()).equals("Credits")){ 
	            System.out.println("loading "+env.creditsURL);
                aj.getAppletContext().showDocument(new URL(env.creditsURL),"_blank"); 
			}
		}catch(Exception ex){}
	 }
     return true;
  }

}
