不用搞什么事件
showDocument()方法相当于做了个超链接,你点击会自动打开
showDocument(URL url,String target);
target可以取下面几个参数:
"_self" 在本框架或窗体打开
"_top"  顶层
"_blank" 新窗体
"_parent" 父窗体打开

解决方案 »

  1.   

    import java.applet.AppletContext;
    import java.net.MalformedURLException;
    import java.net.URL;private void ShowHTMLPage(String s, String s1)
        {
            AppletContext appletcontext = applet.getAppletContext();
            URL url = null;
            try
            {
                url = new URL(s);
            }
            catch(MalformedURLException malformedurlexception)
            {
                DisplayMsg(malformedurlexception.getMessage());
            }
            appletcontext.showDocument(url, s1);
        }
      

  2.   

    楼上的,你把你的程序里的
    ct.showDocument ("http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html ");
    改为
    ct.showDocument ("http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html","_blank");
    试试。
      

  3.   

    1、你必须把字符串转换成url,
    2、s1可以取下面几个参数:
    "_self" 在本框架或窗体打开
    "_top"  顶层
    "_blank" 新窗体
    "_parent" 父窗体打开
      

  4.   

    "http://www.ncsa.uiuc.edu:8080/demoweb/url-primer.html "是字符串,怎么能打开啊!??
      

  5.   

    路过,多问一句,是把它单写成一个method, 然后在鼠标事件或者是按钮事件后调用吗
      

  6.   

    import java.applet.*;
    import java.net.*;
    import java.awt.*;
    public class Applet1
        extends Applet {  //Construct the applet
      public Applet1() {  }  //Initialize the applet
      public void init() {  }
      public boolean mouseDown(Event e,int x,int y)
              {
                AppletContext appletcontext = this.getAppletContext();
     URL url = null;
     try {
       url = new URL("http://www.sohu.com");
     }
     catch (MalformedURLException malformedurlexception) { }
     appletcontext.showDocument(url, "_blank");                  return true;
              }
    }
      

  7.   

    楼主请注意,如果你是在vj或jbuilder下做applet的话,编译的时候会启动小程序浏览器,这样的话是肯定没反应的。你要把编译好的applet类放到网页上测试才行。