importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.io.*;publicclasstableextendsJFrame{Containercp=null;JTablejt=null;StringStrTableTitle[]=newString[3...
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class table extends JFrame{
Container cp=null;
JTable jt=null;
String StrTableTitle[]=new String[3];
String StrTableData[]=new String[3];
public table(){
super("表格");
cp=getContentPane();
StrTableTitle[]={"1","2","3"};
StrTableData[]={{"1","1","1"},{"1","1","1"},{"1","1","1"}};
jt=new JTable(StrTableData,StrTableTitle);
cp.setLayout(new FlowLayout());
cp.add(jt);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setVisible(true);
setSize(400,500);
}
public static void main(String[] args){
new table();
}
}
提示的错误在于
StrTableTitle[]={"1","2","3"};
StrTableData[]={{"1","1","1"},{"1","1","1"},{"1","1","1"}};
求大神!
出错提示
展开