btnOpen.addMouseListener(new MouseAdapter(){
   public void mouseClicked(MouseEvent e){
     try{
       URL url=new URL("http://dymeteo.com");
       Applet1.this.getAppletContext().showDocument(url,"_BLANK"); 
    }catch(java.net.MalformedURLException malE){}
  }
});  

解决方案 »

  1.   

    在java程序中如何弹出呢?(不是applet)
      

  2.   

    好想我还不知道,你的意思应该是启动IE,
    用wfc可能可以。
      

  3.   

    你必须要加上IE的path路径,Runtime rt = System.getRuntime();
    try
    {
        rs.exec("iexplore http://www.sohu.com");
    }catch(Exception e){}
      

  4.   

    你必须要加上IE的path路径,Runtime rt = System.getRuntime();
    try
    {
        rs.exec("iexplore http://www.sohu.com");
    }catch(Exception e){}
      

  5.   

    我调了一个程序,可是不太成功:
    import java.awt.*;
    import java.net.*;
    import java.applet.Applet;
     public class  SiteSelector extends Applet{
      Site siteList[];
      public void init()
      {
      siteList=new Site[2];
      siteList[0]=new Site("Java Union","http://www.deping.net/index.html");
      siteList[1]=new Site("Tom web","http://www.tom.com/index.html");
      for (int i=0;i<siteList.length;i++)  add(new Button (siteList[i].getTitle()));
      }
      public boolean action (Event e,Object arg)
      {
      if (e.target instanceof Button){
       String title;
       URL location;
       for (int i=0;i<siteList.length;i++){
       title=siteList[i].getTitle();
       location=siteList[i].getLocation();
       if(title.equals(arg.toString())){
       gotoSite(location);
       return true;
       }
       }
       }
       return false;
       }
       public void gotoSite(URL loc){
        getAppletContext().showDocument(loc );
       }
       }
     public   class Site extends Button{
       private String title;
       private URL location;
       public Site(String siteTitle,String siteLocation)
       {
       title=siteTitle;
       try{
       location=new URL(siteLocation);
       }
       catch(MalformedURLException e){
       System.err.println("Invalid URL:" + siteLocation);
       }
       }
       public String getTitle(){
       return title;}
      public URL getLocation(){
      return location;}
       }
    ------------------------------------------------------------------------------
    好像不能通过,说Site类未找到
    大虾们帮我看看!
      

  6.   

    import java.awt.*;
    import java.awt.event.*;
    public class exec extends Frame
    {
        Button t =new Button("run program");
        public exec()
        {
            add(t);
            t.addActionListener(new ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    try{
                    Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE www.csdn.net");
                }
                catch(Exception ee)
                {}
                }
            });
        }
        public static void main(String args[])
        {
            exec t=new exec();
            t.setSize(400,400);
            t.setVisible(true);
        }}