问题在注释部分,谢谢大家捧场。import javax.swing.*;
public Test extends JFrame(){
private JScrollPane[] jsp;
private JTextArea[] jta;
private JPanel[] jp;
public static void main(String[] args){
Test t=new Test();
t.go();
}
public Test(){
jsp = new JScrollPane[10];
jta = new JTextArea[10];
jp = new JPanel[10]; jta[0] = new JTextArea(10, 10);
jsp[0] = new JTextPane(jta[0]);
jp[0]=new JPanel();
/*
*为什么下面这句在netbeans6.9.1和eclipse中会报错
*而在netbeans6.8中没有丝毫问题?
*/
jp[0].add(jsp[0]);
getContentPane().add(jp[0],java.awt.BorderLayout.CENTER);
}
public void go(){
setSize(800,600);
setLocationRelativeTo(null);//Center the window in the middle of the screen
setVisible(true);
}
public Test extends JFrame(){
private JScrollPane[] jsp;
private JTextArea[] jta;
private JPanel[] jp;
public static void main(String[] args){
Test t=new Test();
t.go();
}
public Test(){
jsp = new JScrollPane[10];
jta = new JTextArea[10];
jp = new JPanel[10]; jta[0] = new JTextArea(10, 10);
jsp[0] = new JTextPane(jta[0]);
jp[0]=new JPanel();
/*
*为什么下面这句在netbeans6.9.1和eclipse中会报错
*而在netbeans6.8中没有丝毫问题?
*/
jp[0].add(jsp[0]);
getContentPane().add(jp[0],java.awt.BorderLayout.CENTER);
}
public void go(){
setSize(800,600);
setLocationRelativeTo(null);//Center the window in the middle of the screen
setVisible(true);
}
jsp[0] = new JScrollPane(jta[0]);//上面这里写错了,是笔误,问题继续呀,同志们……?
jp[0]=new JPanel();
回warrior319,谢谢你,后来我在eclipse里试过来,真的没有bug,现在的bug就是netbeans6.8与netbeans6.9的问题来。呵呵:多谢。我不管来,至少在netbeans6.8和eclipse里可以很正常运行我的代码。结贴了吧。
少了个class test前
还少了一对{}