代码,
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;public class Mylmlk
{public static void main(String[] agrs){JFrame frame=new JFrame("学生成绩表");frame.setSize(500,200);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Container contentPane=frame.getContentPane();String[] columnNames = {"id","姓名","性别","年龄","成绩"};Object[][] data1 = {{1, "吴一", "男", 20, 65},{2, "李三", "女", 21, 75},{3, "王四", "男", 20, 85},{4, "刘七七", "女", 22, 65},{5, "张一三", "男", 21, 95} };JTable table=new JTable(data1,columnNames);contentPane.add(new JScrollPane(table));frame.setVisible(true);}
}