java程序里面如何打开一个网页链接? cmd = "rundll32 url.dll,FileProtocolHandler http://www.csdn.net"Process p = Runtime.getRuntime().exec(cmd); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 to chenweionline() 可否解释一下这条命令的参数的含义? applet的showDocument()很方便,不知道符合不符合你的要求 cmd = "rundll32 url.dll,FileProtocolHandler http://www.csdn.net"这条命令很好,但我不知道这些参数的意思。 import java.awt.*;import java.awt.event.*;import java.applet.*;import java.net.*;//JAVA程序对网上资源的访问示例(要求网络连接可用,在浏览器中运行)public class AppletTest extends Applet implements ActionListener{ Label lab=new Label("请输入一个网址:"); TextField text=new TextField(30); Button b1=new Button("GO"); URL url; public void init(){ this.add(lab); this.add(text); this.add(b1); b1.addActionListener(this); } public void actionPerformed(ActionEvent e){ if(e.getActionCommand()=="GO"){ try{ url=new URL(text.getText().trim());//获取用户在文档框中输入的URL getAppletContext().showDocument(url);//链接到指定网页 } catch(Exception g){System.out.println(g.toString());} } }//actionPerformed }//AppletTest 接口究竟是不是类? 一个java面试题 时间表??java 在线等 随机密码生成问题 如何让程序在指定时间执行任务 树的问题 远程下载的乱码问题 郁闷!我的浏览器不能浏览 Applet ,是什么原因? 想学java,请大家指教 swing 菜鸟入门小问题 hello world 的异常 用过 UltraEdit 的请进!
可否解释一下这条命令的参数的含义?
这条命令很好,但我不知道这些参数的意思。
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
//JAVA程序对网上资源的访问示例(要求网络连接可用,在浏览器中运行)
public class AppletTest extends Applet implements ActionListener{
Label lab=new Label("请输入一个网址:");
TextField text=new TextField(30);
Button b1=new Button("GO");
URL url;
public void init(){
this.add(lab);
this.add(text);
this.add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
if(e.getActionCommand()=="GO"){
try{
url=new URL(text.getText().trim());//获取用户在文档框中输入的URL
getAppletContext().showDocument(url);//链接到指定网页
}
catch(Exception g){System.out.println(g.toString());}
}
}//actionPerformed
}//AppletTest