Java表格组建的使用
package swimg;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class chart {
public static void main(String[] args) {
JFrame frame=new JFrame("学生成绩表格");
frame.setBounds(200,200,800,200);
Container c=frame.getContentPane();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
Object tableDate[][]=new Object[3][8];
for(int i=0;i<3;i++){
tableDate[i][0]="姓名"+i;
for(int j=1;j<8;j++)
tableDate[i][j]=0;
}
String name[]={"姓名","数学","语文","英语","物理","化学","生物","总成绩"};
JTable table=new JTable(tableDate,name);
c.add(new JScrollPane(table));
}
}