import java.awt.TextArea;
import java.awt.Font;
import java.applet.Applet;
import java.util.Vector;

public class textas extends Applet {
    TextArea text;
    Vector vec;
    public void init() {
	text = new TextArea();
        vec = new Vector();
	int tempi=0;
	int max=0;
	int diff=0;

        String urlNFile = new String("http://www.sdsc.edu/~damartin/cgi-bin/env_java.pl");
        RunCgi infile = new RunCgi();
        infile.ReadIt(urlNFile);
        vec = infile.file;
        String temp=new String();
// Set the font size
	Font f = new Font("Monospaced", Font.BOLD, 12);
	text.setFont(f);

        for (int i=0;i<vec.size();i++) {
            temp=vec.elementAt(i).toString();
	    tempi=temp.length();
	    //System.out.println("temp="+temp+" length="+tempi);
	    if (tempi>30) {
		tempi=0;
	    }
	    if (tempi>max) {
		max=tempi;
	    }
	}
	max+=5;
	//max=25;
        for (int i=0;i<vec.size();i++) {
            temp=vec.elementAt(i).toString();
	    temp.trim();
	    if (Math.IEEEremainder( (float) i, 2.0 )==0.0) {
                text.append(temp+"\n");
	    }
	    else {
		temp=temp+":";
		tempi=temp.length();
		diff=max-tempi;
	    	System.out.println("temp="+temp+" length="+tempi);
		System.out.println("difference="+(max-tempi));
		if (diff<8) {
		    temp=temp+"\t";
		}
		if ( (diff>=8)&(diff<16) ) {
		    temp=temp+"\t\t";
		}
                if ( (diff>=16)&(diff<24) ) {
                    temp=temp+"\t\t\t";
                }
                if ( (diff>=24)&(diff<30) ) {
                    temp=temp+"\t\t\t\t";
                }
                if ( (diff>=30)&(diff<max) ) {
                    temp=temp+"\t\t\t\t\t";
                }
                text.append(temp);
	    }
        }
	add(text);
    }
}
	
