注册 登录
编程论坛 JAVA论坛

关于URL

不落夕阳 发布于 2017-09-07 12:35, 1303 次点击

public class ShowDocument extends JApplet{
    public void init(){
        JButton goButton = new JButton("Link to www.);
        Container myContainer = getContentPane();
        myContainer.add(new JLabel("Link to SOHU"),BorderLayout.NORTH);
    }

    class ButtonListener implements ActionListener{
        public void actionPerformed(ActionEvent e){
            try{
                URL newDocument = new URL("http://www.);
                AppletContext brower = getAppletContext();
                brower.showDocument(newDocument);
            }catch(Exception e1){
                                                                希望各位朋友帮忙解释一下这段代码的功能。谢谢
            }
        }
    }
   
}
0 回复
1