java学校图书借阅管理系统课程设计报告

发布时间 : 星期二 文章java学校图书借阅管理系统课程设计报告更新完毕开始阅读

{

setTitle(\学生信息修改\ setLocation(20,30); setSize(500,600);

setLayout(null);

r1=new JLabel(\学生学号:\ add(r1);

r1.setBounds(220,20,60,20); x1=new JTextField(20); add(x1);

x1.setBounds(175,50,150,20); button0=new JButton(\查找\ add(button0);

button0.setBounds(360,50,60,20); button0.addActionListener(this); JLabel r2=new JLabel(\学生学号:\ add(r2);

r2.setBounds(155,90,60,20); StuNO=new JTextField(20); add(StuNO);

StuNO.setBounds(215,90,150,20); JLabel r3=new JLabel(\学生姓名:\ add(r3);

r3.setBounds(155,130,130,20); StuName=new JTextField(20); add(StuName);

StuName.setBounds(215,130,150,20);

JLabel r4=new JLabel(\学生性别:\ add(r4);

r4.setBounds(155,170,60,20); StuSex=new JTextField(20); add(StuSex);

StuSex.setBounds(215,170,150,20); JLabel r5=new JLabel(\所在院系:\ add(r5);

r5.setBounds(155,210,60,20); add(Stuyuanxi);

Stuyuanxi.setBounds(215,210,150,20); JLabel r6=new JLabel(\所在专业:\ add(r6);

r6.setBounds(155,250,60,20);

StuSpecial=new JTextField(20); add(StuSpecial);

Stuyuanxi=new JTextField(20);

28

{

StuSpecial.setBounds(215,250,150,20); JLabel r7=new JLabel(\班级:\ add(r7);

r7.setBounds(155,290,60,20);

StuClass=new JTextField(20);

add(StuClass);

StuClass.setBounds(215,290,150,20); button11=new JButton(\修改\ add(button11);

button11.setBounds(220,335,60,30); button11.addActionListener(this);

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setVisible(true); }

public void actionPerformed(ActionEvent e)

if(e.getSource()==button0) {

String StuNO0=x1.getText().trim(); Connection con;

Statement stmt; ResultSet rs;

try{ Class.forName(\

con=DriverManager.getConnection(\ stmt=con.createStatement();

rs= stmt.executeQuery(\ if(rs.next()) {

StuNO.setText(rs.getString(1)); StuName.setText(rs.getString(2)); StuSex.setText(rs.getString(3)); Stuyuanxi.setText(rs.getString(4)); StuSpecial.setText(rs.getString(5)); StuClass.setText(rs.getString(6)); StuNO.setEditable(false); }

con.close(); }

catch(Exception e2) { System.out.println(e2); }

}

else if(e.getSource()==button11)

StuNO='\

29

{

String StuNO2=StuNO.getText(); String StuName2=StuName.getText(); String StuSex2= StuSex.getText(); String Stuyuanxi2= Stuyuanxi.getText(); String StuSpecial2= StuSpecial.getText(); String StuClass2= StuClass.getText(); Connection con2;

Statement stmt2; ResultSet rs2;

try{ Class.forName(\con2=DriverManager.getConnection(\ stmt2=con2.createStatement(); String sql=\

StuNO='\StuSex2+\

StuSpecial2+\

stmt2.executeUpdate(sql); StuNO.setText(null); StuName.setText(null); StuSex.setText(null); Stuyuanxi.setText(null); StuSpecial.setText(null); StuClass.setText(null);

JOptionPane.showMessageDialog(this, \修改成功!\消息对

话\PLAIN_MESSAGE); this.setVisible(false); }

}catch(Exception e3){ System.out.print(e3);}

}

}

30

4.10 学生信息删除模块设计

截图

源代码

class studelete extends JFrame implements ActionListener {

JButton button66; JTextField k3; studelete() {

public void actionPerformed(ActionEvent e) {

String k33=k3.getText(); Connection con; Statement sql; ResultSet rs;

try{ Class.forName(\ }

catch(ClassNotFoundException e1) {

31

setTitle(\学生信息删除\

setLocation(20,30);

setLayout(new FlowLayout());

setSize(500,150);

add(new JLabel(\请输入要删除的学生学号:\ k3=new JTextField(10); add(k3);

button66=new JButton(\删除\ add(button66);

button66.addActionListener(this);

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setVisible(true); }

联系合同范文客服:xxxxx#qq.com(#替换为@)