可以写一个applet,大致代码如下,你自己修改吧:
package mshtang.applet;
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;/**
 * <p>Title: Search</p>
 * <p>Description: 用于站内搜索的Java小程序</p>
 * <p>Copyright: 一方公司版权所有Copyright (c) 2002</p>
 * <p>Company: 厦门一方软件公司</p>
 * @author 小唐蔡
 * @version 1.0
 */public class Search extends Applet implements Runnable
{
  public Search()
  {
    criteria = "或";
    nofollow = false;
    linksonly = false;
    forwardonly = false;
  }  public void stop()
  {
    if(th != null)
    {
      try
      {
        th.yield();
      }
      catch(Exception _ex) { }
      th = null;
    }
  }  public void destroy()
  {
    th = null;
  }  public void init()
  {
    getAllParameters();
    try
    {
      firsturl = new URL(getDocumentBase(), indexpage);
      baseurl = getBase(firsturl.toString());
    }
    catch(Exception _ex) { }
    allUrls = new Vector();
    urls = new Vector();
    paired = new Hashtable();
    entitys = new Hashtable(htmlEntitys.length * 2);
    loadEntitys(htmlEntitys, entitys);
    label1 = new Label();
    label2 = new Label();
    checkbox1 = new Checkbox();
    checkbox2 = new Checkbox();
    checkbox3 = new Checkbox();
    textField1 = new TextField();
    button1 = new Button();
    list1 = new java.awt.List();
    p = new Panel();
    p.setLayout(new BorderLayout());
    setLayout(null);
    setBackground(new Color(appletbg));
    textField1.setBackground(new Color(textfieldbg));
    textField1.setForeground(new Color(textfieldfg));
    label1.setForeground(new Color(labelfg));
    label1.setBackground(new Color(labelbg));
    label1.setFont(new Font(labelfont, 1, labelfontsize));
    label1.setText(labeltext.trim());
    label2.setBackground(new Color(checkboxbg));
    label2.setForeground(new Color(checkboxfg));
    label2.setFont(new Font(appletfont, 0, appletfontsize));
    label2.setText(checkboxtext1);
    checkbox1.setBackground(new Color(checkboxbg));
    checkbox1.setForeground(new Color(checkboxfg));
    checkbox1.setFont(new Font(appletfont, 0, appletfontsize));
    checkbox1.setLabel(checkboxtext2);
    checkbox1.setState(true);
    checkbox2.setBackground(new Color(checkboxbg));
    checkbox2.setForeground(new Color(checkboxfg));
    checkbox2.setFont(new Font(appletfont, 0, appletfontsize));
    checkbox2.setLabel(checkboxtext3);
    checkbox3.setBackground(new Color(checkboxbg));
    checkbox3.setForeground(new Color(checkboxfg));
    checkbox3.setFont(new Font(appletfont, 0, appletfontsize));
    checkbox3.setLabel(checkboxtext4);
    button1.setBackground(new Color(buttonbg));
    button1.setForeground(new Color(buttonfg));
    button1.setLabel(buttontext1);
    list1.setForeground(new Color(listfg));
    list1.setBackground(new Color(listbg));
    label1.setBounds(labelx, labely, labelwidth, labelheight);
    label2.setBounds(chbox1x, chbox1y, chbox1width, chbox1height);
    checkbox1.setBounds(chbox2x, chbox2y, chbox2width, chbox2height);
    checkbox2.setBounds(chbox3x, chbox3y, chbox3width, chbox3height);
    checkbox3.setBounds(chbox4x, chbox4y, chbox4width, chbox4height);
    textField1.setBounds(txtfieldx, txtfieldy, txtfieldwidth, txtfieldheight);
    button1.setBounds(buttonx, buttony, buttonwidth, buttonheight);
    p.setBounds(listx, listy, listwidth, listheight);
    list1.setSize(listwidth, listheight);
    p.add("Center", list1);
    add(label1);
    add(textField1);
    add(label2);
    add(checkbox1);
    add(checkbox2);
    add(checkbox3);
    add(button1);
    add(p);
    try
    {
      System.out.println("\n\n 站内检索小程序。\nCopyright (c) 2002 厦门一方软件公司,\nhttp://www.efound.com.cn\n");
      return;
    }
    catch(Exception _ex)
    {
      return;
    }
  }

解决方案 »

  1.   

    续:
    void getAllParameters()
      {
        try
        {
          indexpage = getStringParameter("firstpage", "index.html");
          targetName = getStringParameter("targetname", "_top");
          labeltext = getStringParameter("labeltext_XSWQ123sde", "站内检索小程序");
          checkboxtext1 = getStringParameter("checkboxtext1", "条件");
          checkboxtext2 = getStringParameter("checkboxtext2", "或");
          checkboxtext3 = getStringParameter("checkboxtext3", "和");
          checkboxtext4 = getStringParameter("checkboxtext4", "短语");
          buttontext1 = getStringParameter("buttontext1", "开始");
          buttontext2 = getStringParameter("buttontext2", "停止");
          completedtext = getStringParameter("completedtext", "搜索完毕,双击你需要的链接。");
          notfoundtext = getStringParameter("notfoundtext", "没有发现匹配内容");
          parsingtext = getStringParameter("parsingtext", "解析链接: ");
          searchingtext = getStringParameter("searchingtext", "在结果内检索: ");
          readingtext = getStringParameter("readingtext", "解析链接: ");
          labelfont = getStringParameter("labelfont", "Dialog");
          appletfont = getStringParameter("appletfont", "Dialog");
          maxhits = getIntParameter("maxhits", "30", 10);
          truncate = getIntParameter("truncate", "50", 10);
          labelfontsize = getIntParameter("labelfontsize", "11", 10);
          appletfontsize = getIntParameter("appletfontsize", "10", 10);
          labelfg = getIntParameter("labelfg", "FFFFFF", 16);
          labelbg = getIntParameter("labelbg", "000080", 16);
          appletbg = getIntParameter("appletbg_XSWQ123sde", "008080", 16);
          textfieldbg = getIntParameter("textfieldbg", "00A880", 16);
          checkboxbg = getIntParameter("checkboxbg", "008080", 16);
          checkboxfg = getIntParameter("checkboxfg", "000000", 16);
          buttonbg = getIntParameter("buttonbg", "CCCCCC", 16);
          buttonfg = getIntParameter("buttonfg", "0000FF", 16);
          listbg = getIntParameter("listbg", "CCCCCC", 16);
          listfg = getIntParameter("listfg", "0000FF", 16);
          textfieldfg = getIntParameter("textfieldfg", "000000", 16);
          labelx = getIntParameter("labelx", "0", 10);
          labely = getIntParameter("labely", "0", 10);
          labelwidth = getIntParameter("labelwidth", "360", 10);
          labelheight = getIntParameter("labelheight", "24", 10);
          chbox1x = getIntParameter("chbox1x", "2", 10);
          chbox1y = getIntParameter("chbox1y", "30", 10);
          chbox1width = getIntParameter("chbox1width", "40", 10);
          chbox1height = getIntParameter("chbox1height", "15", 10);
          chbox2x = getIntParameter("chbox2x", "60", 10);
          chbox2y = getIntParameter("chbox2y", "30", 10);
          chbox2width = getIntParameter("chbox2width", "54", 10);
          chbox2height = getIntParameter("chbox2height", "15", 10);
          chbox3x = getIntParameter("chbox3x", "115", 10);
          chbox3y = getIntParameter("chbox3y", "30", 10);
          chbox3width = getIntParameter("chbox3width", "56", 10);
          chbox3height = getIntParameter("chbox3height", "15", 10);
          chbox4x = getIntParameter("chbox4x", "172", 10);
          chbox4y = getIntParameter("chbox4y", "30", 10);
          chbox4width = getIntParameter("chbox4width", "65", 10);
          chbox4height = getIntParameter("chbox4height", "15", 10);
          txtfieldx = getIntParameter("txtfieldx", "6", 10);
          txtfieldy = getIntParameter("txtfieldy", "50", 10);
          txtfieldwidth = getIntParameter("txtfieldwidth", "251", 10);
          txtfieldheight = getIntParameter("txtfieldheight", "28", 10);
          buttonx = getIntParameter("buttonx", "265", 10);
          buttony = getIntParameter("buttony", "52", 10);
          buttonwidth = getIntParameter("buttonwidth", "48", 10);
          buttonheight = getIntParameter("buttonheight", "25", 10);
          listx = getIntParameter("listx", "6", 10);
          listy = getIntParameter("listy", "84", 10);
          listwidth = getIntParameter("listwidth", "307", 10);
          listheight = getIntParameter("listheight", "77", 10);
          nofollow = getStringParameter("nofollow", "false").equalsIgnoreCase("true");
          linksonly = getStringParameter("linksonly", "false").equalsIgnoreCase("true");
          forwardonly = getStringParameter("forwardonly", "false").equalsIgnoreCase("true");
          if(buttontext1.equalsIgnoreCase(buttontext2))
          {
            buttontext1 = "开始";
            buttontext2 = "停止";
            return;
          }
        }
        catch(Exception _ex) { }
      }  public String getStringParameter(String s, String s1)
      {
        if(getParameter(s) != null)
        {
          return getParameter(s);
        }
        else
        {
          return s1;
        }
      }  public int getIntParameter(String s, String s1, int i)
      {
        int j;
        try
        {
          String s2 = getParameter(s);
          if(s2 != null)
          {
            j = Integer.parseInt(s2, i);
          }
          else
          {
            j = Integer.parseInt(s1, i);
          }
        }
        catch(Exception _ex)
        {
          j = Integer.parseInt(s1, i);
        }
        return j;
      }  public String getBase(String s)
      {
        int i = s.lastIndexOf("/");
        if(i != -1)
        {
          return s.substring(0, i + 1);
        }
        else
        {
          return s;
        }
      }  void loadEntitys(String as[], Hashtable hashtable)
      {
        int i = 0;
        try
        {
          while(i < as.length)
          {
            String s = as[i];
            i++;
            String s1 = as[i];
            i++;
            String s2 = as[i];
            hashtable.put(s1, s);
            hashtable.put(s2, s);
            i++;
          }
          return;
        }
        catch(ArrayIndexOutOfBoundsException _ex)
        {
          return;
        }
      }
      

  2.   

    续:
    void startThread()
      {
        if(th != null)
        {
          th.yield();
          th = null;
        }
        th = new Thread(this);
        th.start();
      }  void stopThread()
      {
        button1.setLabel(buttontext1);
        if(hits > 0)
        {
          labelMsg(completedtext);
        }
        else
        {
          labelMsg(notfoundtext);
        }
        if(th != null)
        {
          try
          {
            th.yield();
          }
          catch(Exception _ex) { }
          th = null;
        }
      }  public void run()
      {
        register(firsturl.toString());
        Search(textField1.getText(), criteria, firsturl);
        stopThread();
      }  void Search(String s, String s1, URL url)
      {
        String s2 = "";
        String s3 = null;
        String s4 = "";
        Enumeration enumeration = null;
        try
        {
          s2 = readURL(url);
        }
        catch(Exception _ex)
        {
          return;
        }
        labelMsg(searchingtext + url.toString());
        if(!nofollow)
        {
          enumeration = getLinks(s2, url);
        }
        else if(nofollow && url.toString().equalsIgnoreCase(firsturl.toString()))
        {
          enumeration = getLinks(s2, url);
        }
        s2 = translateEntitys(s2);
        if(!linksonly)
        {
          s3 = getTitle(s2);
        }
        else
        {
          s3 = null;
        }
        s2 = removeHTML(s2);
        s4 = url.toString();
        if(paired.containsKey(s4))
        {
          s4 = (String)paired.get(s4);
        }
        if(s1.equalsIgnoreCase("或") && matchAny(s, s2))
        {
          report(s4, s3);
        }
        else if(s1.equalsIgnoreCase("和") && matchAll(s, s2))
        {
          report(s4, s3);
        }
        else if(s1.equalsIgnoreCase("短语") && matchPhrase(s, s2))
        {
          report(s4, s3);
        }
        for(; enumeration != null && enumeration.hasMoreElements(); Search(s, s1, (URL)enumeration.nextElement()));
      }  boolean matchAny(String s, String s1)
      {
        String s2 = s.toLowerCase();
        String s3 = s1.toLowerCase();
        for(StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false); stringtokenizer.hasMoreTokens();)
        if(s3.indexOf(stringtokenizer.nextToken()) != -1)
        {
          return true;
        }
        return false;
      }  boolean matchAll(String s, String s1)
      {
        String s2 = s.toLowerCase();
        String s3 = s1.toLowerCase();
        StringTokenizer stringtokenizer = new StringTokenizer(s2, ", ", false);
        int i = stringtokenizer.countTokens();
        while(stringtokenizer.hasMoreTokens())
        {
          if(s3.indexOf(stringtokenizer.nextToken()) != -1)
          {
            i--;
          }
        }
        return i == 0;
      }  boolean matchPhrase(String s, String s1)
      {
        String s2 = s.toLowerCase().trim();
        String s3 = s1.toLowerCase();
        StringTokenizer stringtokenizer = new StringTokenizer(s2, ",", false);
        stringtokenizer.countTokens();
        while(stringtokenizer.hasMoreTokens())
        {
          if(s3.indexOf(stringtokenizer.nextToken().trim()) != -1)
          {
            return true;
          }
        }
        return false;
      }  String getTitle(String s)
      {
        String s1 = "标题";
        int i = truncate;
        String s2 = s.toLowerCase();
        int j = s2.indexOf(s1);
        int k = s2.indexOf("<", j + s1.length());
        String s3 = "";
        j = s2.indexOf(">", j);
        if(j >= 0 && k > 0 && j < k)
        {
          s3 = s.substring(j + 1, k);
          if(s3.length() > i)
          {
            s3 = s3.substring(0, i) + "...";
          }
          s3 = s3.replace('\n', ' ');
          s3 = s3.trim();
        }
        if(!s3.equals(""))
        {
           return s3;
        }
        else
        {
          return null;
        }
      }