此为简易的浏览器程序,当我输入www.baidu.com时却出现
java.net.MalformedURLException: no protocol: www.sohu.cn
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at Swing_.MyBrowser.actionPerformed(MyBrowser.java:51)等错误,不知道怎么回事,请高手为我初学者指点迷津:以下为程序源码
*********************************package Swing_;import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;public class MyBrowser extends JFrame implements HyperlinkListener,ActionListener {
private JTextField jtextField=new JTextField();
private JPanel jpanel=new JPanel();
private JButton jbutton=new JButton("转到");
private JEditorPane jeditor=new JEditorPane();
private JScrollPane jscrollbar=new JScrollPane(jeditor);
URL page;
public MyBrowser(){//构造方法
jeditor.setEditable(false);//设置编辑器面板为不可编辑
jpanel.setLayout(null);
jtextField.setBounds(10,10, 500, 26);
jbutton.setBounds(520, 10, 80, 26);
jbutton.addActionListener(this);
jtextField.addActionListener(this);
jscrollbar.setBounds(5, 40, 602, 430);
jpanel.add(jtextField);
jpanel.add(jbutton);
jpanel.add(jscrollbar);
this.add(jpanel);
   this.setTitle("浏览器");
   this.setVisible(true);
   this.setBounds(200, 200, 700, 600);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void actionPerformed(ActionEvent e){//侦听器
String url=jtextField.getText().trim();
if (url == null) {
           new IOException("invalid url");
        }

try {
page = new URL(url);
} catch (MalformedURLException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
};
try {
jeditor.setPage(page);
} catch (IOException e1) {
this.errorm();
e1.printStackTrace();
}
}
public void hyperlinkUpdate(HyperlinkEvent e){//侦听器
if(e.getEventType()==HyperlinkEvent.EventType.ACTIVATED){
try {
jeditor.setPage(e.getURL());
} catch (IOException e1) {
this.errorm();
e1.printStackTrace();
}
}
}
public void errorm(){

File file=new File("src\\Swing_\\erro.html");
try {
jeditor.setPage(file.toURI().toURL());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new MyBrowser();
}
}