import java.awt.*;
import java.lang.*;
import java.applet.*;
import java.util.*;
import java.net.*;
import java.io.*;
public class GChech extends Applet
{
static Socket socket;
static InputStream in;
static OutputStream out;
static DataInputStream din;
static DataOutputStream dout;
Button button = null;
String rc = null;
protected Vector entries = null;
protected Vector header = null;
protected File file = null;
protected String name = null;
protected String e_mail = null;
protected String entry = null;
protected String date = null;
String lin2;
public void loadbook(String name)
{
File f = new File(name);
if(f.exists()&&f.canRead()) readFromFile(f);
else System.out.println("This file doesn't exist.");
}
public void init()
{
setBackground(Color.lightGray);
setForeground(Color.blue);
Font font = new Font("TimesRoman",Font.PLAIN,20);
setFont(font);
setLayout(new BorderLayout());
Panel p1=new Panel();
p1.add( button=new Button("Genernate"));
add("North",p1);
}
public boolean action(Event evt,Object what)
{
if (what.equals("Genernate")) // button pressed
{
loadbook("guestdata");
}
else return false;
return true;
}
public boolean fromHTML(String line)
{
int index = line.indexOf("
");
if(index<0) return false;
line = line.substring(index+4);
index = line.indexOf(" | ");
if(index<0) return false;
name = line.substring(0,index).trim();
line = line.substring(index+4);
index = line.indexOf(" | ");
if(index<0) return false;
e_mail = line.substring(0,index).trim();
line = line.substring(index+4);
index = line.indexOf(" | ");
if(index<0) return false;
entry = line.substring(0,index).trim();
date = line.substring(index+4).trim();
return true;
}
public void readFromFile(File f)
{
file = f;
header = new Vector(5);
FileInputStream fin = null;
FileOutputStream fout = null;
try { fin = new FileInputStream(f);}
catch(Exception fe)
{
System.out.println("caught exception "+fe.getMessage());
header = null;
entries = null;
return;
}
try { fout = new FileOutputStream("CheckForUpdate.html"); }
catch(IOException ioe)
{
System.out.println("warning: couldn't save guestbook");
return;
}
DataOutputStream dout = new DataOutputStream(fout);
try
{
dout.writeBytes("\nCheckForUpdate\n\nThis is a Java program that takes a URL as argument and checks to see if the document the URL points to has changed since the last\n");
dout.writeBytes(" |