snoLabel.setBounds(20, 60, 40, 25);...................................................................................................XXVIII
snoText.setBounds(60, 60, 120, 25);...................................................................................................XXVIII
this.add(snoLabel);..............................................................................................................................XXVIII
this.add(snoText);................................................................................................................................XXVIII
JLabel snameLabel = new JLabel("姓名");........................................................................................XXVIII
snameText = new JTextField();...........................................................................................................XXVIII
snameLabel.setBounds(220, 60, 40, 25);............................................................................................XXVIII
snameText.setBounds(260, 60, 120, 25);............................................................................................XXVIII
this.add(snameLabel);..........................................................................................................................XXVIII
this.add(snameText);............................................................................................................................XXVIII
JLabel sexlabel = new JLabel("性别");...............................................................................................XXVIII
String[] sex = { "男", "女" };...............................................................................................................XXVIII
sexcom = new JComboBox(sex);........................................................................................................XXVIII
sexlabel.setBounds(20, 90, 40, 25);....................................................................................................XXVIII
sexcom.setBounds(60, 90, 120, 25);...................................................................................................XXVIII
this.add(sexlabel);................................................................................................................................XXVIII
this.add(sexcom);.................................................................................................................................XXVIII
JLabel ageLabel = new JLabel("年龄");.............................................................................................XXVIII
ageText = new JTextField();................................................................................................................XXVIII
ageLabel.setBounds(220, 90, 40, 25);.................................................................................................XXVIII
ageText.setBounds(260, 90, 120, 25);.................................................................................................XXVIII
this.add(ageLabel);..............................................................................................................................XXVIII
this.add(ageText);................................................................................................................................XXVIII
JLabel classlabel = new JLabel("班级");............................................................................................XXVIII
String[] classes = { "信息 081", "信息 082", "物流 081" };...............................................................XXVIII
classcom = new JComboBox(classes);...............................................................................................XXVIII
classlabel.setBounds(20, 120, 40, 25);................................................................................................XXVIII
classcom.setBounds(60, 120, 120, 25);...............................................................................................XXVIII
this.add(classlabel);.............................................................................................................................XXVIII
this.add(classcom);..............................................................................................................................XXVIII
JLabel departlabel = new JLabel("学院");.............................................................................................XXIX
String[] depart = { "造纸", "理学院", "机电学院" };...........................................................................XXIX
departcom = new JComboBox(depart);.................................................................................................XXIX
departlabel.setBounds(220, 120, 40, 25);..............................................................................................XXIX
departcom.setBounds(260, 120, 120, 25);.............................................................................................XXIX
this.add(departlabel);..............................................................................................................................XXIX
this.add(departcom);...............................................................................................................................XXIX
// 录入数据.............................................................................................................................................XXIX
JButton addbtn = new JButton("录入");................................................................................................XXIX
addbtn.setBounds(150, 180, 60, 30);.....................................................................................................XXIX
addbtn.addActionListener(new addAction());.......................................................................................XXIX
this.add(addbtn);.....................................................................................................................................XXIX
.................................................................................................................................................................XXIX
// 返回.....................................................................................................................................................XXIX
JButton backbtn = new JButton("返回");..............................................................................................XXIX
backbtn.setBounds(230, 180, 60, 30);....................................................................................................XXIX
backbtn.addActionListener(new BackAction ());..................................................................................XXIX
this.add(backbtn);...................................................................................................................................XXIX
this.setLocationRelativeTo(null); // 使窗体居中..................................................................................XXIX
this.setResizable(false);// 固定窗体大小..............................................................................................XXIX
this.setVisible(true); // 设置窗体可见...................................................................................................XXIX
//this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 窗体关闭时,程序结束................XXIX
}..............................................................................................................................................................XXIX
// 获取文本框或选择框的值.................................................................................................................XXIX
public Student getStudent() {.................................................................................................................XXIX
Student stu = new Student();..................................................................................................................XXIX
评论0
最新资源