学校管理java代码 java学生管理系统源代码

求用Java编写的学生成绩管理系统的完整代码package jdbcproj;
import java.sql.*;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.awt.event.ActionEvent;
public class MainFrame extends JFrame {
private JPanel contentPane;
private JTextField txtname;
private JTextField txtpassword;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame frame = new MainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 661, 399);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("\u7528\u6237\u540D");
lblNewLabel.setBounds(114, 51, 72, 18);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("\u5BC6\u7801");
lblNewLabel_1.setBounds(114, 106, 72, 18);
contentPane.add(lblNewLabel_1);
txtname = new JTextField();
txtname.setBounds(261, 48, 86, 24);
contentPane.add(txtname);
txtname.setColumns(10);
txtpassword = new JTextField();
txtpassword.setBounds(261, 103, 86, 24);
contentPane.add(txtpassword);
txtpassword.setColumns(10);
JButton btnadd = new JButton("\u589E\u52A0");
btnadd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(txtname.getText().equals("")||txtpassword.getText().equals(""))
{
JOptionPane.showMessageDialog(getContentPane(), "用户名和密码不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);
}
else{
Users u=new Users();
u.setPwd(txtpassword.getText());
u.setUsername(txtname.getText());
UserDAO usdo=new UserDAO();
usdo.addUser(u);
}
}
});
btnadd.setBounds(45, 205, 113, 27);
contentPane.add(btnadd);
JButton btndelete = new JButton("\u5220\u9664");
btndelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(txtname.getText().equals(""))
{
JOptionPane.showMessageDialog(getContentPane(), "用户名不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);
}
else{
UserDAO usdo=new UserDAO();
usdo.delUser(txtname.getText());;
}
}
});
btndelete.setBounds(172, 205, 113, 27);
contentPane.add(btndelete);
JButton btnupdate = new JButton("\u4FEE\u6539");
btnupdate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(txtname.getText().equals("")||txtpassword.getText().equals(""))
{
JOptionPane.showMessageDialog(getContentPane(), "用户名和密码不能为空","提示信息框",JOptionPane.WARNING_MESSAGE);
}
else{
Users u=new Users();
u.setPwd(txtpassword.getText());
u.setUsername(txtname.getText());
UserDAO usdo=new UserDAO();
usdo.updateUser(u);;
}
}
});
btnupdate.setBounds(300, 205, 113, 27);
contentPane.add(btnupdate);
JButton btnfind = new JButton("\u67E5\u8BE2");
btnfind.addActionListener(new ActionListener() {

推荐阅读