如果不去掉的话,应该怎么改呢?
----------------解决方案--------------------------------------------------------
给我看代码
----------------解决方案--------------------------------------------------------
import java.awt.*;
import javax.swing.*;
import java.net.*;
import java.io.*;
public class JTextPaneDemo extends JFrame{ //就是这个public
public JTextPaneDemo(){
JTextPane tp = new JTextPane();
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane();
Container cp = getContentPane();
cp.add(jsp);
setSize(400,300);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
try{
URL myadd = new URL("http://www.163.com");
tp.setPage(myadd);
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String[] args){
JTextPaneDemo tpd = new JTextPaneDemo();
}
}
----------------解决方案--------------------------------------------------------
你的文件名必须为JTextPaneDemo.java,否则不能使用public
----------------解决方案--------------------------------------------------------