精华内容
下载资源
问答
  • 学生管理系统课程设计附带源码

    千次阅读 多人点赞 2021-03-08 22:05:36
    学生管理系统学生信息管理系统,要求完成以下基本任务: 改写程序为良好程序风格(文档注释,函数注释,语句注释)。 将功能补充完全(基于文件处理,完成刷新和保存功能)。 将学生信息改为更好的数据组织,而...

    1. 问题要求及任务描述
    1.1. 题目要求
    学生管理系统
    对学生信息管理系统,要求完成以下基本任务:

    1. 改写程序为良好程序风格(文档注释,函数注释,语句注释)。
    2. 将功能补充完全(基于文件处理,完成刷新和保存功能)。
    3. 将学生信息改为更好的数据组织,而非离散形式(结构体)

    1.2. 主要任务

    1. 能够对学生的有关资料进行输入,查询,修改,删除。
    2. 能够为学校提供强大的查询功能,以便管理人员了解和掌握学生的具体 情况。
    3. 能够对数据库和登陆记录进行清理。
    4. 可以对用户进行修改密码,新增用户。
      2.1. 采用解决问题的方法
      首先就是学生信息的录入,要求将信息用文件保存,在这里我设计了一个类Student,有9个成员变量分别是
      private int id; //学生编号
      private String stuName;//学生姓名
      private String stuXue;//学生学院
      private String stuIdcarde;//学生学号
      private String stuSex;//学生性别
      private String stuAge;//学生年龄
      private String stuAddress;//学生地址
      private String stuPhone;//学生联系方式
      private String stuTypeid;//学生班级,
      除了id(自加,且唯一)是int类型,其他都是string类型,同时里面还有成员函数,
      public int add(Connection con,Student student)throws Exception
      public int update(Connection con,Student student)throws Exception
      分别向程序里面读数据和写入数据,还有负责添一条数据的成员函数add()可以添加一条信息,同时我将学生的信息有list容器存放。。
      然后我是先做查询的,因为这有做了查询才能删除和修改,查询我也是按照学号查询,查询出来的信息在右边的实例编辑框中展示出来,然后对编辑框进行一些属性的调整,例如可下滑(当文本长度过长时可下滑)、可换行、只读,然后学号和姓名等都设置可输入编辑框,只有当对应查询方式有效时才能进行查询,,若有效会进行查询将对应结果输出,无输出结果会有对应的提示框弹出。然后我做了删除和修改,这是用按照学号查询的方法来查询的。 在这里我们可以看到,通过对学生学号的搜索从而查询所要查询的学生信息


    2.2. 主要算法和处理流程图
    学生管理系统主要流程图
    2.3功能演示
    请添加图片描述
    请添加图片描述
    请添加图片描述
    2.4项目源码
    1.dao类

    
    ```java
    在这里插入代码片
    
    package hiai.dao;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    
    import hiai.model.GradeType;
    import hiai.model.Student;
    import hiai.util.StringUtil;
    
    /**
     * 
     * 
     * 对学生的添加,删除,修改。
     * @author zzz
     *
     */
    public class StudentDao {
    	/**
    	 * 
    	 * 学生添加
    	 */
    	public int add(Connection con,Student student)throws Exception {
    		
    		String sql="insert into stu_student values(null,?,?,?,?,?,?,?,?)";
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, student.getStuName());
    		pstmt.setString(2, student.getStuXue());
    		pstmt.setString(3, student.getStuIdcarde());
    		pstmt.setString(4, student.getStuSex());
    		pstmt.setString(5, student.getStuAge());
    		pstmt.setString(6, student.getStuAddress());
    		pstmt.setString(7, student.getStuPhone());
    		pstmt.setString(8, student.getStuTypeid());
    		return pstmt.executeUpdate();
    	}
    	/**
    	 * 查询学生集合
    	 */
    	public ResultSet list(Connection con,Student student)throws Exception {
    		StringBuffer sb=new StringBuffer("select * from stu_student");
    		if(StringUtil.isNotEmpty(student.getStuIdcarde())) {
    			sb.append(" and stuIdcard like '%"+student.getStuIdcarde()+"%'");
    			
    		}
    		PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
    		
    		return pstmt.executeQuery();
    		
    	}
    	/**
    	 * 学生删除
    	 */
    	public int delete (Connection con,String id)throws Exception{
    		String sql="delete from stu_student where id=?";//删除操作
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, id);
    		
    		return pstmt.executeUpdate();
    	}
    	
    	/**
    	 * 
    	 * 学生修改
    	 */
    	public int update(Connection con,Student student)throws Exception{
    		String sql="update stu_student set stuName=?,stuXue=?,stuIdcard=?,stuSex=?,stuAge=?,stuAddress=?,stuPhone=?,stuTypeid=? where id=?";
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, student.getStuName());
    		pstmt.setString(2, student.getStuXue());
    		pstmt.setString(3, student.getStuIdcarde());
    		pstmt.setString(4, student.getStuSex());
    		pstmt.setString(5, student.getStuAge());
    		pstmt.setString(6, student.getStuAddress());
    		pstmt.setString(7, student.getStuPhone());
    		pstmt.setString(8, student.getStuTypeid());
    		pstmt.setInt(9, student.getId());	
    		return pstmt.executeUpdate();
    		
    	}
    	
    
    }
    
    package hiai.dao;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    
    import hiai.model.GradeType;
    import hiai.util.StringUtil;
    
    /**
     * 班级类别类
     * 班级添加,删除,更新,查询的操作
     * 
     * @author zzz
     *
     */
    
    public class GradeTypeDao {
    	/*
    	 * 班级添加
    	 */
    	public int add(Connection con,GradeType gradeType)throws Exception{
    		String sql="insert into stu_grade values (null,?,?,?)";//班级添加sql语句
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, gradeType.getGradeXue());
    		pstmt.setString(2, gradeType.getGradeName());
    		pstmt.setString(3, gradeType.getGradeDesc());
    		return pstmt.executeUpdate();	
    	}
    	/*
    	 * 
    	 * 查询班级集合
    	 */
    	public ResultSet list(Connection con,GradeType gradeType)throws Exception{
    		StringBuffer sb=new StringBuffer("select * from stu_grade");
    		if(StringUtil.isNotEmpty(gradeType.getGradeName())) {
    			sb.append(" and gradeName like '%"+gradeType.getGradeName()+"%'");
    			
    		}
    		PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and","where"));
    		return pstmt.executeQuery();
    		
    		
    		
    	}
    	/*
    	 * 班级删除
    	 */
    	public int delete (Connection con,String id)throws Exception{
    		String sql="delete from stu_grade where id=?";//删除操作
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, id);
    		
    		return pstmt.executeUpdate();
    	}
    	/*
    	 * 班级修改
    	 */
    	public int update(Connection con,GradeType gradeType)throws Exception{
    		String sql="update stu_grade set gradeXue=?,gradeName=?,gradeDesc=? where id=?";
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, gradeType.getGradeXue());
    		pstmt.setString(2, gradeType.getGradeName());
    		pstmt.setString(3, gradeType.getGradeDesc());
    		pstmt.setInt(4, gradeType.getId());
    		return pstmt.executeUpdate();
    		
    	}
    }
    
    package hiai.dao;
    
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    
    import com.mysql.cj.xdevapi.PreparableStatement;
    
    import hiai.model.User;
    
    /**
     * 用户访问数据库
     * @author zzz
     *
     */
    public class UserDao {
    	/*
    	 * 登陆验证,判断用户名和密码是否正确。
    	 */
    	public User login(Connection con,User user) throws Exception{
    		User resultUser=null;
    		String sql="select * from stu_user where username =? and password=?";
    		PreparedStatement pstmt=con.prepareStatement(sql);
    		pstmt.setString(1, user.getUserName());
    		pstmt.setString(2, user.getPassWord());
    		ResultSet rs= pstmt.executeQuery();
    		if(rs.next()) {
    			resultUser=new User();
    			resultUser.setId(rs.getInt("id"));
    			resultUser.setUserName(rs.getString("userName"));
    			resultUser.setPassWord(rs.getString("passWord"));
    			
    			
    		}
    		
    		return resultUser;
    		
    		
    	}
    
    }
    
    
    
    

    2.model类

    package hiai.model;
    /**
     * 
     * 
     * 班级分类实体
     * @author zzz
     *
     */
    
    public class GradeType {
    	private int id;//编号
    	private String gradeXue;//学院名称
    	private String gradeName;//班级名称
    	private String gradeDesc;//班级备注
    	public int getId() {
    		return id;
    	}
    	public void setId(int id) {
    		this.id = id;
    	}
    	public GradeType(String gradeXue, String gradeName, String gradeDesc) {
    		super();
    		this.gradeXue = gradeXue;
    		this.gradeName = gradeName;
    		this.gradeDesc = gradeDesc;
    	}
    	public GradeType() {
    		super();
    		// TODO Auto-generated constructor stub
    	}
    	public String getGradeXue() {
    		return gradeXue;
    	}
    	public void setGradeXue(String gradeXue) {
    		this.gradeXue = gradeXue;
    	}
    	public String getGradeName() {
    		return gradeName;
    	}
    	public void setGradeName(String gradeName) {
    		this.gradeName = gradeName;
    	}
    	public String getGradeDesc() {
    		return gradeDesc;
    	}
    	public void setGradeDesc(String gradeDesc) {
    		this.gradeDesc = gradeDesc;
    	}
    	public GradeType(int id, String gradeXue, String gradeName, String gradeDesc) {
    		super();
    		this.id = id;
    		this.gradeXue = gradeXue;
    		this.gradeName = gradeName;
    		this.gradeDesc = gradeDesc;
    	}
    	public String toString() {
    		return gradeName;
    		
    		
    	}
    	
    
    }
    
    package hiai.model;
    /**
     * 学生模型
     * @author zzz
     *
     */
    public class Student {
    	private int id; //学生编号
    	private String stuName;//学生姓名
    	private String stuXue;//学生学院
    	private String stuIdcarde;//学生学号
    	private String stuSex;//学生性别
    	private String stuAge;//学生年龄
    	private String stuAddress;//学生地址
    	private String stuPhone;//学生联系方式
    	private String stuTypeid;//学生班级
    	/**
    	 * @return the id
    	 */
    	public int getId() {
    		return id;
    	}
    	/**
    	 * @param id the id to set
    	 */
    	public void setId(int id) {
    		this.id = id;
    	}
    	public Student() {
    		super();
    		// TODO Auto-generated constructor stub
    	}
    	/**
    	 * @return the stuName
    	 */
    	public String getStuName() {
    		return stuName;
    	}
    	/**
    	 * @param stuName the stuName to set
    	 */
    	public void setStuName(String stuName) {
    		this.stuName = stuName;
    	}
    	/**
    	 * @return the stuXue
    	 */
    	public String getStuXue() {
    		return stuXue;
    	}
    	/**
    	 * @param stuXue the stuXue to set
    	 */
    	public void setStuXue(String stuXue) {
    		this.stuXue = stuXue;
    	}
    	/**
    	 * @return the stuIdcarde
    	 */
    	public String getStuIdcarde() {
    		return stuIdcarde;
    	}
    	/**
    	 * @param stuIdcarde the stuIdcarde to set
    	 */
    	public void setStuIdcarde(String stuIdcarde) {
    		this.stuIdcarde = stuIdcarde;
    	}
    	/**
    	 * @return the stuSex
    	 */
    	public String getStuSex() {
    		return stuSex;
    	}
    	/**
    	 * @param stuSex the stuSex to set
    	 */
    	public void setStuSex(String stuSex) {
    		this.stuSex = stuSex;
    	}
    	/**
    	 * @return the stuAge
    	 */
    	public String getStuAge() {
    		return stuAge;
    	}
    	/**
    	 * @param stuAge the stuAge to set
    	 */
    	public void setStuAge(String stuAge) {
    		this.stuAge = stuAge;
    	}
    	/**
    	 * @return the stuAddress
    	 */
    	public String getStuAddress() {
    		return stuAddress;
    	}
    	/**
    	 * @param stuAddress the stuAddress to set
    	 */
    	public void setStuAddress(String stuAddress) {
    		this.stuAddress = stuAddress;
    	}
    	/**
    	 * @return the stuPhone
    	 */
    	public String getStuPhone() {
    		return stuPhone;
    	}
    	/**
    	 * @param stuPhone the stuPhone to set
    	 */
    	public void setStuPhone(String stuPhone) {
    		this.stuPhone = stuPhone;
    	}
    	public Student(String stuName, String stuXue, String stuIdcarde, String stuSex, String stuAge, String stuAddress,
    			String stuPhone, String stuTypeid) {
    		super();
    		this.stuName = stuName;
    		this.stuXue = stuXue;
    		this.stuIdcarde = stuIdcarde;
    		this.stuSex = stuSex;
    		this.stuAge = stuAge;
    		this.stuAddress = stuAddress;
    		this.stuPhone = stuPhone;
    		this.stuTypeid = stuTypeid;
    	}
    	public Student(int id, String stuName, String stuXue, String stuIdcarde, String stuSex, String stuAge,
    			String stuAddress, String stuPhone, String stuTypeid) {
    		super();
    		this.id = id;
    		this.stuName = stuName;
    		this.stuXue = stuXue;
    		this.stuIdcarde = stuIdcarde;
    		this.stuSex = stuSex;
    		this.stuAge = stuAge;
    		this.stuAddress = stuAddress;
    		this.stuPhone = stuPhone;
    		this.stuTypeid = stuTypeid;
    	}
    	/**
    	 * @return the stuTypeid
    	 */
    	public String getStuTypeid() {
    		return stuTypeid;
    	}
    	/**
    	 * @param stuTypeid the stuTypeid to set
    	 */
    	public void setStuTypeid(String stuTypeid) {
    		this.stuTypeid = stuTypeid;
    	}
    	
    	
    	
    }
    
    package hiai.model;
    /**
     * 用户的实体,密码,用户名
     * @author 默默
     * 
     *
     */
    
    public class User {
    	private int id; 
    	private String userName;
    	private String passWord;
    	private int is_admin;
    	public int getId() {
    		return id;
    	}
    	public void setId(int id) {
    		this.id = id;
    	}
    	public String getUserName() {
    		return userName;
    	}
    	public void setUserName(String userName) {
    		this.userName = userName;
    	}
    	public String getPassWord() {
    		return passWord;
    	}
    	public void setPassWord(String passWord) {
    		this.passWord = passWord;
    	}
    
    	public User(String userName, String passWord) {
    		super();
    		this.userName = userName;
    		this.passWord = passWord;
    	}
    	public User() {
    		super();
    		// TODO Auto-generated constructor stub
    	}
    	public int getIs_admin() {
    		return is_admin;
    	}
    	public void setIs_admin(int is_admin) {
    		this.is_admin = is_admin;
    	}
    	
    
    }
    

    3.util类

    package hiai.util;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    
    /*
     * 链接数据库
     */
    public class DbUTil {
    	private String dbUrl="jdbc:mysql://localhost:3306/xueshengguanli ?serverTimezone=GMT%2B8";
    	private String dbUserName="root";
    	private String dbPassword="XU2638375241";//数据库密码
    	//private String jdbcName="com.mysql.jdbc.Driver";//驱动名称
    	//数据库连接
    	public Connection getCon() throws Exception{
    		//Class.forName(jdbcName);
    		Connection con=DriverManager.getConnection(dbUrl,dbUserName,dbPassword);
    		return con;	
    	}
    	//数据库的关闭
       public void closeCon(Connection con) throws Exception{
    	   if(con!=null) {
    		   
    		   con.close();   
    	   }   
       }
       public static void main(String[] args) {
    	   
    	   DbUTil dbUtil=new DbUTil();
    	   try {
    		   dbUtil.getCon();
    		   System.out.println("数据库连接成功");
    		
    	} catch (Exception e) {
    		// TODO: handle exception
    		e.printStackTrace();
    	}
    	   
    	   
       }
    }
    
    package hiai.util;
    
    public class StringUtil {
    	
    	/*
    	 * 判断是否为空
    	 */
    	public static boolean isEmpty(String str) {
    		if(str==null||"".equals(str.trim())) {
    			return true;
    			
    		}
    		else {
    		return false;
    		}
    		
    		
    	}
    	public static boolean isNotEmpty(String str) {
    		if(str!=null&&!"".equals(str.trim())) {
    			return true;
    			
    		}
    		else {
    		return false;
    		}
    		
    		
    		
    	}
    	
    	
    
    }
    

    4.view类

    package hiai.view;
    
    import java.awt.Color;
    import java.awt.EventQueue;
    
    import javax.swing.JInternalFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import net.miginfocom.swing.MigLayout;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.JComboBox;
    import javax.swing.JTextArea;
    import javax.swing.LayoutStyle.ComponentPlacement;
    import javax.swing.border.LineBorder;
    
    import hiai.dao.GradeTypeDao;
    import hiai.model.GradeType;
    import hiai.util.DbUTil;
    import hiai.util.StringUtil;
    
    import java.awt.Font;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.awt.event.ActionEvent;
    
    public class GradeTypeAddFrm extends JInternalFrame {
    	private JTextField gradeXue;
    	private final JLabel lblNewLabel_1 = new JLabel("New label");
    	private JTextField gradeName;
    	private JTextArea gradeDesc;
    	private DbUTil dbUtil =new DbUTil();
    	private GradeTypeDao gradeTypeDao=new GradeTypeDao();
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					GradeTypeAddFrm frame = new GradeTypeAddFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public GradeTypeAddFrm() {
    		setIconifiable(true);
    		setClosable(true);
    		setTitle("\u73ED\u7EA7\u6DFB\u52A0");
    		setBounds(100, 100, 738, 422);
    		
    		JLabel lblNewLabel = new JLabel("\u5B66\u9662\u540D\u79F0\uFF1A");
    		lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 16));
    		
    		gradeXue = new JTextField();
    		gradeXue.setColumns(10);
    		
    		JLabel lblNewLabel_2 = new JLabel("\u73ED\u7EA7\u540D\u79F0\uFF1A");
    		lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 16));
    		
    		JLabel lblNewLabel_3 = new JLabel("\u5907\u6CE8\uFF1A");
    		lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 16));
    		
    		gradeName = new JTextField();
    		gradeName.setColumns(10);
    		
    		JButton btnNewButton = new JButton("\u6DFB\u52A0");
    		btnNewButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				gradeTypeAddActionPerfromed();
    				
    			}
    		});
    		
    		JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
    		btnNewButton_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				resetActionPerformed(e);
    				
    			}
    		});
    		
    		 gradeDesc = new JTextArea();
    		GroupLayout groupLayout = new GroupLayout(getContentPane());
    		groupLayout.setHorizontalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(52)
    					.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
    					.addGap(99)
    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    						.addGroup(groupLayout.createSequentialGroup()
    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    								.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_2)
    								.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE))
    							.addPreferredGap(ComponentPlacement.RELATED)
    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    								.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
    									.addComponent(gradeName, Alignment.LEADING)
    									.addComponent(gradeXue, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE))
    								.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    									.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    									.addComponent(gradeDesc, GroupLayout.PREFERRED_SIZE, 331, GroupLayout.PREFERRED_SIZE))))
    						.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
    					.addGap(145))
    		);
    		groupLayout.setVerticalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addContainerGap()
    					.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 0, GroupLayout.PREFERRED_SIZE)
    					.addGap(14)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel)
    						.addComponent(gradeXue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_2)
    						.addComponent(gradeName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(47)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_3)
    						.addComponent(gradeDesc, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE))
    					.addPreferredGap(ComponentPlacement.RELATED, 147, Short.MAX_VALUE)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton)
    						.addComponent(btnNewButton_1))
    					.addGap(73))
    		);
    		getContentPane().setLayout(groupLayout);
    		
    		//优化文本域边框
    		gradeDesc.setBorder(new LineBorder(new Color(127,157,185),1,false));
    		
    
    	}
    	/*
    	 * 
    	 * 班级添加
    	 */
    	private void gradeTypeAddActionPerfromed() {
    		// TODO Auto-generated method stub
    		String gradeXue=this.gradeXue.getText();//得到用户输入学院的信息
    		String gradeName=this.gradeName.getText();//班级名称
    		String gradeDesc=this.gradeDesc.getText();//班级备注
    		//判断是否为空
    		if(StringUtil.isEmpty(gradeXue)) {
    			JOptionPane.showMessageDialog(null, "学院名称不能为空");
    			return ;
    			
    		}
    		if(StringUtil.isEmpty(gradeName)) {
    			JOptionPane.showMessageDialog(null, "班级名称不能为空");
    			return;
    			
    		}
    		if(StringUtil.isEmpty(gradeDesc)) {
    			JOptionPane.showMessageDialog(null, "班级备注不能为空");
    			return;	
    		}
    		GradeType gradeType=new GradeType( gradeXue,  gradeName,  gradeDesc);
    		Connection con= null;
    		try {
    			con=dbUtil.getCon();
    			int   n =gradeTypeDao.add(con, gradeType);
    			if(n==1) {
    				JOptionPane.showMessageDialog(null, "班级添加成功");
    				resetValues();
    				
    			}
    			else {
    				JOptionPane.showMessageDialog(null, "班级添加失败");
    			}
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);//关闭数据库
    			} catch (Exception e2) {
    				// TODO: handle exception
    				e2.printStackTrace();
    			}
    		}
    		
    		
    		
    	}
    
    	/**
    	 * 重置事件操作
    	 * @param e
    	 */
    
    	private void resetActionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		this.resetValues();
    		
    	}
    	private void resetValues() {
    		this.gradeXue.setText("");
    		this.gradeName.setText("");
    		this.gradeDesc.setText("");
    		
    		
    		
    		
    		
    	}
    }
    
    
    
    
    
    package hiai.view;
    import java.awt.Color;
    /**
     * 维护窗口
     * 
     */
    import java.awt.EventQueue;
    
    import javax.swing.JInternalFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.LayoutStyle.ComponentPlacement;
    import javax.swing.JScrollPane;
    import java.awt.Font;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.util.Vector;
    
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    
    import hiai.dao.GradeTypeDao;
    import hiai.model.GradeType;
    import hiai.util.DbUTil;
    import hiai.util.StringUtil;
    
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JPanel;
    import javax.swing.border.LineBorder;
    import javax.swing.border.TitledBorder;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    
    public class GradeTypeManageFrm extends JInternalFrame {
    	private JTextField s_gradeNameTxt;
    	private JTable gradeTypeTable;
    	private DbUTil dbUtil =new DbUTil();
    	private GradeTypeDao gradeTypeDao=new GradeTypeDao();
    	private JTextField gradeIdTxt;
    	private JTextField gradeXueTxt;
    	private JTextField gradeNameTxt;
    	private JTextField gradeDescTxt;
    
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					GradeTypeManageFrm frame = new GradeTypeManageFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public GradeTypeManageFrm() {
    		setIconifiable(true);
    		setClosable(true);
    		setTitle("\u73ED\u7EA7\u7EF4\u62A4");
    		setBounds(100, 100, 760, 490);
    		
    		JLabel lblNewLabel = new JLabel("\u73ED\u7EA7\u540D\u79F0");
    		lblNewLabel.setFont(new Font("宋体", Font.BOLD, 13));
    		
    		s_gradeNameTxt = new JTextField();
    		s_gradeNameTxt.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    			}
    		});
    		s_gradeNameTxt.setColumns(10);
    		
    		JButton btnNewButton = new JButton("\u67E5\u8BE2");
    		btnNewButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				gradeNameSearchActionPerformed(e);
    			}
    		});
    		btnNewButton.setFont(new Font("宋体", Font.BOLD, 13));
    		
    		JScrollPane pane = new JScrollPane();
    		
    		JPanel panel = new JPanel();
    		panel.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    		panel.setToolTipText("\u8868\u5355\u64CD\u4F5C");
    		
    		gradeTypeTable = new JTable();
    		gradeTypeTable.addMouseListener(new MouseAdapter() {
    			@Override
    			public void mousePressed(MouseEvent e) {
    				gradeTypeTableMousePressed(e);
    			}
    		});
    		gradeTypeTable.setModel(new DefaultTableModel(
    			new Object[][] {
    			},
    			new String[] {
    				"\u7F16\u53F7", "\u5B66\u9662\u540D\u79F0", "\u73ED\u7EA7\u540D\u79F0", "\u73ED\u7EA7\u5907\u6CE8"
    			}
    		) {
    			boolean[] columnEditables = new boolean[] {
    				false, false, true, true
    			};
    			public boolean isCellEditable(int row, int column) {
    				return columnEditables[column];
    			}
    		});
    		pane.setViewportView(gradeTypeTable);
    		
    		JButton btnNewButton_1 = new JButton("\u4FEE\u6539");
    		btnNewButton_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				gradeTypeUpdateActionEvent(e);
    			}
    		});
    		
    		JButton btnNewButton_2 = new JButton("\u5220\u9664");
    		btnNewButton_2.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				gradeTypeDeleteActionPerformed(e);
    			}
    		});
    		GroupLayout groupLayout = new GroupLayout(getContentPane());
    		groupLayout.setHorizontalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
    					.addContainerGap(138, Short.MAX_VALUE)
    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
    						.addGroup(groupLayout.createSequentialGroup()
    							.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    							.addComponent(btnNewButton_2, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
    						.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
    							.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addGap(60)
    							.addComponent(s_gradeNameTxt, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE)
    							.addGap(59)
    							.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
    						.addComponent(panel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
    						.addComponent(pane, Alignment.TRAILING))
    					.addGap(143))
    		);
    		groupLayout.setVerticalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(25)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
    						.addComponent(s_gradeNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE))
    					.addGap(19)
    					.addComponent(pane, GroupLayout.PREFERRED_SIZE, 121, GroupLayout.PREFERRED_SIZE)
    					.addGap(10)
    					.addComponent(panel, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)
    					.addGap(56)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton_1)
    						.addComponent(btnNewButton_2))
    					.addContainerGap(39, Short.MAX_VALUE))
    		);
    		
    		JLabel lblNewLabel_1 = new JLabel("\u73ED\u7EA7\u7F16\u53F7");
    		
    		gradeIdTxt = new JTextField();
    		gradeIdTxt.setEditable(false);
    		gradeIdTxt.setColumns(10);
    		
    		JLabel lblNewLabel_2 = new JLabel("\u5B66\u9662\u540D\u79F0");
    		
    		gradeXueTxt = new JTextField();
    		gradeXueTxt.setColumns(10);
    		
    		JLabel lblNewLabel_3 = new JLabel("\u73ED\u7EA7\u540D\u79F0");
    		
    		gradeNameTxt = new JTextField();
    		gradeNameTxt.setColumns(10);
    		
    		JLabel lblNewLabel_4 = new JLabel("\u73ED\u7EA7\u5907\u6CE8\uFF1A");
    		
    		gradeDescTxt = new JTextField();
    		gradeDescTxt.setColumns(10);
    		GroupLayout gl_panel = new GroupLayout(panel);
    		gl_panel.setHorizontalGroup(
    			gl_panel.createParallelGroup(Alignment.LEADING)
    				.addGroup(gl_panel.createSequentialGroup()
    					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
    						.addGroup(gl_panel.createSequentialGroup()
    							.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addGap(27)
    							.addComponent(gradeIdTxt, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
    							.addGap(18)
    							.addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.UNRELATED)
    							.addComponent(gradeXueTxt, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE))
    						.addGroup(gl_panel.createSequentialGroup()
    							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
    								.addComponent(lblNewLabel_4, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE))
    							.addGap(18)
    							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
    								.addComponent(gradeNameTxt, GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
    								.addComponent(gradeDescTxt, GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE))))
    					.addGap(54))
    		);
    		gl_panel.setVerticalGroup(
    			gl_panel.createParallelGroup(Alignment.LEADING)
    				.addGroup(gl_panel.createSequentialGroup()
    					.addContainerGap()
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_1)
    						.addComponent(lblNewLabel_2)
    						.addComponent(gradeXueTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(gradeIdTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_3)
    						.addComponent(gradeNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_4)
    						.addComponent(gradeDescTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addContainerGap(13, Short.MAX_VALUE))
    		);
    		panel.setLayout(gl_panel);
    		getContentPane().setLayout(groupLayout);
    		//调用初始化
    		this.fillTable(new GradeType());
    
    		//优化文本域边框
    		gradeDescTxt.setBorder(new LineBorder(new Color(127,157,185),1,false));
    		
    
    
    	}
    	/**
    	 * 
    	 * 删除操作
    	 * @param e
    	 */
        private void gradeTypeDeleteActionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
        	String id=gradeIdTxt.getText();
            if(StringUtil.isEmpty(id)) {
    			
    			JOptionPane.showMessageDialog(null, "请选择要删除的记录");
    			return;
    		}
    		int n=JOptionPane.showConfirmDialog(null, "确定要删除该条件记录吗?");
    		if(n==0) {
    			Connection con=null;
    			try {
    				con=dbUtil.getCon();
    				//
    				//
    				int deleteNum=gradeTypeDao.delete(con, id);
    				if(deleteNum==1) {
    					JOptionPane.showMessageDialog(null, "删除成功");
    					resetValue();
    					fillTable(new GradeType());
    				}
    				else {
    					
    					JOptionPane.showMessageDialog(null, "删除失败");
    				}
    			} catch (Exception e1) {
    				// TODO Auto-generated catch block
    				e1.printStackTrace();
    			}finally {
    				try {
    					dbUtil.closeCon(con);//关闭数据库
    				}
    				catch (Exception e1) {
    					// TODO: handle exception
    					e1.printStackTrace();
    				}
    			}
    			
    		}
    	}
    
    	/*
         * 
         * 事件修改生成
         */
    	private void gradeTypeUpdateActionEvent(ActionEvent evt) {
    		// TODO Auto-generated method stub
    		String id=gradeIdTxt.getText();
    		String gradeXue=gradeXueTxt.getText();
    		String gradeName=gradeNameTxt.getText();
    		String gradeDesc=gradeDescTxt.getText();
    		if(StringUtil.isEmpty(id)) {
    			
    			JOptionPane.showMessageDialog(null, "请选择要修改的记录");
    			return;
    		}
            if(StringUtil.isEmpty(gradeXue)) {
    			
    			JOptionPane.showMessageDialog(null, "学院名称不能为空!");
    			return;
    		}
            if(StringUtil.isEmpty(gradeName)) {
    			
    			JOptionPane.showMessageDialog(null, "班级名称不能为空!");
    			return;
    		}
             if(StringUtil.isEmpty(gradeDesc)) {
    	
    	        JOptionPane.showMessageDialog(null, "班级备注不能为空!");
    	        return;
            }
             GradeType  gradeType=new GradeType( Integer.parseInt(id),  gradeXue,  gradeName,  gradeDesc);
             Connection con=null;
             try {
    			con=dbUtil.getCon();
    			int modifyNum=gradeTypeDao.update(con, gradeType);
    			if(modifyNum==1) {
    				JOptionPane.showMessageDialog(null, "修改成功");
    				resetValue();
    				fillTable(new GradeType());
    			}
    			else {
    				JOptionPane.showMessageDialog(null, "修改失败");
    			}
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
             finally {
     			try {
     				dbUtil.closeCon(con);//关闭数据库
     			}
     			catch (Exception e) {
     				// TODO: handle exception
     				e.printStackTrace();
     			}
     		}
    	}
    	/*
    	 * 重置操作
    	 */
    	private void resetValue() {
    		// TODO Auto-generated method stub
    		this.gradeIdTxt.setText("");
    		this.gradeXueTxt.setText("");
    		this.gradeNameTxt.setText("");
    		this.gradeDescTxt.setText("");
    		
    	}
    
    	/**
    	 * 表格的单击事件
    	 * @param e
    	 */	private void gradeTypeTableMousePressed(MouseEvent e) {
    		// TODO Auto-generated method stub
    		int row= gradeTypeTable.getSelectedRow();
    		gradeIdTxt.setText((String)gradeTypeTable.getValueAt(row, 0));
    		gradeXueTxt.setText((String)gradeTypeTable.getValueAt(row, 1));
    		gradeNameTxt.setText((String)gradeTypeTable.getValueAt(row, 2));
    		gradeDescTxt.setText((String)gradeTypeTable.getValueAt(row, 3));
    	}
    
    	/*
    	 * 
    	 * 班级查询
    	 */
    	private void gradeNameSearchActionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		String s_gradeName= this.s_gradeNameTxt.getText();
    		GradeType gradeType=new GradeType();
    		gradeType.setGradeName(s_gradeName);
    		this.fillTable(gradeType);
    		
    	}
    
    	/**
    	 * 初始化表格
    	 * 
    	 */
    	private void fillTable(GradeType gradeType) {
    		DefaultTableModel dtm= (DefaultTableModel)gradeTypeTable.getModel();
    		dtm.setRowCount(0);
    		Connection con=null;
    		try {
    			con=dbUtil.getCon();
    			ResultSet rs= gradeTypeDao.list(con, gradeType);
    			while(rs.next()) {
    				Vector v=new Vector();
    			    v.add(rs.getString("id"));
    				v.add(rs.getString("gradeXue"));
    				v.add(rs.getString("gradeName"));
    				v.add(rs.getString("gradedesc"));
    				dtm.addRow(v);
    				
    			}
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    			
    		}
    		finally {
    			try {
    				dbUtil.closeCon(con);//关闭数据库
    			} catch (Exception e2) {
    				// TODO: handle exception
    				e2.printStackTrace();
    			}
    		}
    		
    	}
    }
    
    
    
    
     package hiai.view;
    
    import java.awt.EventQueue;
    
    import javax.swing.JInternalFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JLabel;
    import java.awt.Color;
    import java.awt.Font;
    import javax.swing.LayoutStyle.ComponentPlacement;
    
    public class hiailnterFrm extends JInternalFrame {
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					hiailnterFrm frame = new hiailnterFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public hiailnterFrm() {
    		setForeground(Color.WHITE);
    		setIconifiable(true);
    		setClosable(true);
    		setTitle("\u4F5C\u8005\u8BF4");
    		setBounds(100, 100, 686, 441);
    		
    		JLabel lblNewLabel = new JLabel("\u4F5C\u8005\u8BF4");
    		lblNewLabel.setFont(new Font("宋体", Font.BOLD, 18));
    		
    		JLabel lblNewLabel_1 = new JLabel("\u672C\u7A0B\u5E8F\u662F\u7531\u4F5C\u80058\u5C11\u4E00\u624B\u521B\u529E\u5982\u9700\u4F7F\u7528\u8BF7\u8054\u7CFB");
    		lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 16));
    		
    		JLabel lblNewLabel_2 = new JLabel("\u4E0D\u5F97\u79C1\u81EA\u8F6C\u8F7D");
    		lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 16));
    		
    		JLabel lblNewLabel_3 = new JLabel("\u8054\u7CFB\u65B9\u5F0F \uFF1A");
    		lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 16));
    		GroupLayout groupLayout = new GroupLayout(getContentPane());
    		groupLayout.setHorizontalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    						.addGroup(groupLayout.createSequentialGroup()
    							.addGap(242)
    							.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE))
    						.addGroup(groupLayout.createSequentialGroup()
    							.addGap(111)
    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    								.addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 435, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 323, GroupLayout.PREFERRED_SIZE))))
    					.addContainerGap(128, Short.MAX_VALUE))
    		);
    		groupLayout.setVerticalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(33)
    					.addComponent(lblNewLabel)
    					.addPreferredGap(ComponentPlacement.UNRELATED)
    					.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
    					.addPreferredGap(ComponentPlacement.UNRELATED)
    					.addComponent(lblNewLabel_2)
    					.addGap(18)
    					.addComponent(lblNewLabel_3)
    					.addContainerGap(240, Short.MAX_VALUE))
    		);
    		getContentPane().setLayout(groupLayout);
    
    	}
    }
    
    package hiai.view;
    
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;
    
    import hiai.dao.UserDao;
    import hiai.model.User;
    import hiai.util.DbUTil;
    import hiai.util.StringUtil;
    
    import java.awt.Toolkit;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JButton;
    import javax.swing.LayoutStyle.ComponentPlacement;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    
    import java.awt.Font;
    import java.awt.event.ActionListener;
    import java.sql.Connection;
    import java.awt.event.ActionEvent;
    import javax.swing.JPasswordField;
    
    public class LogOnFrm extends JFrame {
    
    	private JPanel contentPane;
    	private JTextField userName;
    	private JPasswordField passWord;
    	private DbUTil dbUtil=new DbUTil();
    	private UserDao userDao=new UserDao();
    	
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					LogOnFrm frame = new LogOnFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public LogOnFrm() {
    		setIconImage(Toolkit.getDefaultToolkit().getImage(LogOnFrm.class.getResource("/images/3785578738346ce49929ad358ab12747.jpeg")));
    		setTitle("\u5B66\u751F\u7BA1\u7406\u7CFB\u7EDF");
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		setBounds(100, 100, 554, 403);
    		contentPane = new JPanel();
    		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    		setContentPane(contentPane);
    		
    		JButton btnNewButton = new JButton("\u767B\u5F55");
    		btnNewButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				loginActionPerformed(e);
    			}
    		});
    		btnNewButton.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
    		btnNewButton_1.setFont(new Font("宋体", Font.PLAIN, 15));
    		btnNewButton_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				
    				resetActionPerformed(e);
    			}
    		});
    		
    		userName = new JTextField();
    		userName.setColumns(10);
    		
    		JLabel lblNewLabel = new JLabel("\u7528\u6237\u540D");
    		lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 18));
    		
    		JLabel lblNewLabel_1 = new JLabel("\u5BC6\u7801");
    		lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 18));
    		
    		JLabel lblNewLabel_2 = new JLabel("\u5B66\u751F\u7BA1\u7406\u7CFB\u7EDF");
    		lblNewLabel_2.setFont(new Font("宋体", Font.BOLD, 26));
    		
    		passWord = new JPasswordField();
    		GroupLayout gl_contentPane = new GroupLayout(contentPane);
    		gl_contentPane.setHorizontalGroup(
    			gl_contentPane.createParallelGroup(Alignment.LEADING)
    				.addGroup(gl_contentPane.createSequentialGroup()
    					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
    						.addGroup(gl_contentPane.createSequentialGroup()
    							.addGap(97)
    							.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    							.addGap(117)
    							.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
    						.addGroup(gl_contentPane.createSequentialGroup()
    							.addGap(103)
    							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
    								.addComponent(lblNewLabel)
    								.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE))
    							.addGap(59)
    							.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
    								.addComponent(passWord)
    								.addComponent(userName, GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)))
    						.addGroup(gl_contentPane.createSequentialGroup()
    							.addGap(172)
    							.addComponent(lblNewLabel_2)))
    					.addContainerGap(109, Short.MAX_VALUE))
    		);
    		gl_contentPane.setVerticalGroup(
    			gl_contentPane.createParallelGroup(Alignment.LEADING)
    				.addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
    					.addGap(31)
    					.addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
    					.addGap(39)
    					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 18, GroupLayout.PREFERRED_SIZE)
    						.addComponent(userName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(54)
    					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
    						.addComponent(passWord, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE))
    					.addPreferredGap(ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
    					.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton)
    						.addComponent(btnNewButton_1))
    					.addGap(52))
    		);
    		contentPane.setLayout(gl_contentPane);
    		//设置窗口居中显示
    		this.setLocationRelativeTo(null);
    	}
    	protected void loginActionPerformed(ActionEvent evt) {
    		// TODO Auto-generated method stub
    		String userName=this.userName.getText();
    		String passWord=new String(this.passWord.getPassword());
    		
    		if(StringUtil.isEmpty(userName)) {
    			JOptionPane.showMessageDialog(null, "用户名不能为空");
    			return;
    			
    			
    		}
    		if(StringUtil.isEmpty(passWord)) {
    			JOptionPane.showMessageDialog(null, "密码不能为空");
    			return;	
    		}
    		User user=new User(userName,passWord);
    		Connection con=null;
    		try {
    			con=dbUtil.getCon();
    			User currenUser=userDao.login(con, user);
    			if(currenUser!=null) {
    
    				dispose();//销毁当前窗口
    				new MainFrm().setVisible(true);//创建新的窗口
    			}
    			else {
    				JOptionPane.showMessageDialog(null, "用户名或密码错误");
    				
    			}
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);//关闭数据库
    			}
    			catch (Exception e) {
    				// TODO: handle exception
    				e.printStackTrace();
    			}
    		}
    		
    	}
    
    	private void resetActionPerformed(ActionEvent evt) {
    		// TODO Auto-generated method stub
    		this.userName.setText("");
    		this.passWord.setText("");
    	}
    
    }
    
    
    
    
    
    
    package hiai.view;
    
    import java.awt.BorderLayout;
    import java.awt.EventQueue;
    
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;
    
    import com.mysql.cj.xdevapi.Table;
    
    import java.awt.Toolkit;
    import javax.swing.JMenuBar;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JOptionPane;
    import javax.swing.ImageIcon;
    import javax.swing.JDesktopPane;
    import java.awt.Color;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import java.awt.CardLayout;
    import java.awt.GridBagLayout;
    import javax.swing.BoxLayout;
    import javax.swing.JLabel;
    import java.awt.FlowLayout;
    /**
     * 系统主界面
     * @author zzz
     *
     */
    public class MainFrm extends JFrame {
    	private JDesktopPane table=null;
    
    	private JPanel contentPane;
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					MainFrm frame = new MainFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public MainFrm() {
    		setAutoRequestFocus(false);
    		setTitle("\u5B66\u751F\u7BA1\u7406\u7CFB\u7EDF\u4E3B\u754C\u9762");
    		setIconImage(Toolkit.getDefaultToolkit().getImage(MainFrm.class.getResource("/images/3785578738346ce49929ad358ab12747.jpeg")));
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		setBounds(100, 100, 846, 701);
    		
    		JMenuBar menuBar = new JMenuBar();
    		setJMenuBar(menuBar);
    		
    		JMenu mnNewMenu_3 = new JMenu("\u7CFB\u7EDF\u8BBE\u7F6E");
    		menuBar.add(mnNewMenu_3);
    		
    		JMenuItem mntmNewMenuItem_5 = new JMenuItem("\u9000\u51FA\u7A0B\u5E8F");
    		mntmNewMenuItem_5.addActionListener(new ActionListener() {
    			@SuppressWarnings("deprecation")
    			public void actionPerformed(ActionEvent e) {
    				
    				int a=JOptionPane.showConfirmDialog(null, "是否退出程序");
    				if(a==0) {
    					
    					
    				System.exit(0);;//销毁程序
    				}
    				
    			}
    
    
    		});
    		mnNewMenu_3.add(mntmNewMenuItem_5);
    		
    		JMenuBar menuBar_1 = new JMenuBar();
    		mnNewMenu_3.add(menuBar_1);
    		
    		JMenu mnNewMenu = new JMenu("\u73ED\u7EA7\u7BA1\u7406");
    		menuBar.add(mnNewMenu);
    		
    		JMenuItem mntmNewMenuItem = new JMenuItem("\u73ED\u7EA7\u6DFB\u52A0");
    		mntmNewMenuItem.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				GradeTypeAddFrm gradeTypeAddFrm=new GradeTypeAddFrm();
    				gradeTypeAddFrm.setVisible(true);
    				table.add(gradeTypeAddFrm);
    				
    			}
    			
    			
    		});
    		mnNewMenu.add(mntmNewMenuItem);
    		
    		JMenuItem mntmNewMenuItem_1 = new JMenuItem("\u73ED\u7EA7\u7EF4\u62A4");
    		mntmNewMenuItem_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
         			GradeTypeManageFrm gradeTypeManageFrm=new GradeTypeManageFrm();
    				gradeTypeManageFrm.setVisible(true);
    				table.add(gradeTypeManageFrm);
    				
    			}
    		});
    		mnNewMenu.add(mntmNewMenuItem_1);
    		
    		JMenu mnNewMenu_1 = new JMenu("\u5B66\u751F\u7BA1\u7406");
    		menuBar.add(mnNewMenu_1);
    		
    		JMenuItem mntmNewMenuItem_2 = 
    				new JMenuItem("\u5B66\u751F\u6DFB\u52A0");
    		mntmNewMenuItem_2.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				StudentAddFrm studentAddFrm =new StudentAddFrm();
    				studentAddFrm.setVisible(true);
    				table.add(studentAddFrm);
    			}
    		});
    		mnNewMenu_1.add(mntmNewMenuItem_2);
    		
    		JMenuItem mntmNewMenuItem_3 = new JMenuItem("\u5B66\u751F\u7EF4\u62A4");
    		mntmNewMenuItem_3.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				StudentManageFrm studentAddFrm =new StudentManageFrm();
    				studentAddFrm.setVisible(true);
    				table.add(studentAddFrm);
    				
    			}
    		});
    		mnNewMenu_1.add(mntmNewMenuItem_3);
    		
    		JMenu mnNewMenu_2 = new JMenu("\u5173\u4E8E\u6211\u4EEC");
    		menuBar.add(mnNewMenu_2);
    		
    		JMenuItem mntmNewMenuItem_4 = new JMenuItem("\u4F5C\u8005\u8BF4");
    		mntmNewMenuItem_4.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				hiailnterFrm hiai=new hiailnterFrm();
    				hiai.setVisible(true);
    				table.add(hiai);
    				
    			}
    		});
    		mnNewMenu_2.add(mntmNewMenuItem_4);
    		contentPane = new JPanel();
    		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    		setContentPane(contentPane);
    		 contentPane.setLayout(new CardLayout(0, 0));
    		
    		 table = new JDesktopPane();
    		table.setBackground(Color.GRAY);
    		contentPane.add(table, "name_1386392240138500");
    		table.setLayout(new BoxLayout(table, BoxLayout.X_AXIS));
    		
    		//设置窗口默认最大化
    		//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
    		
    	}
    }
    
    package hiai.view;
    /*
     * 学生添加窗口
     */
    import java.awt.EventQueue;
    
    import javax.swing.JInternalFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JTextField;
    import javax.swing.LayoutStyle.ComponentPlacement;
    
    import hiai.dao.GradeTypeDao;
    import hiai.dao.StudentDao;
    import hiai.model.GradeType;
    import hiai.model.Student;
    import hiai.util.DbUTil;
    import hiai.util.StringUtil;
    
    import java.awt.Font;
    import java.sql.Connection;
    import java.sql.ResultSet;
    
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JRadioButton;
    import javax.swing.JButton;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JTextArea;
    
    public class StudentAddFrm extends JInternalFrame {
    	private JTextField stuNameTxt;
    	private JTextField stuXueTxt;
    	private JTextField stuIdcardTxt;
    	private JTextField stuAgeTxt;
    	private JTextField stuPhoneTxt;
    	private JTextField stuAddressTxt;
    	private DbUTil dbUtil =new DbUTil();
    	private GradeTypeDao gradeTypeDao=new GradeTypeDao();
    	private StudentDao studentDao=new StudentDao();
    	private JRadioButton manJcb;
    	private JRadioButton femaleJcb; 
    	private JTextField stuTypeidTxt;
    
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					StudentAddFrm frame = new StudentAddFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public StudentAddFrm() {
    		setClosable(true);
    		setIconifiable(true);
    		setTitle("\u5B66\u751F\u6DFB\u52A0");
    		setBounds(100, 100, 750, 476);
    		
    		JLabel lblNewLabel = new JLabel("\u5B66\u751F\u59D3\u540D");
    		lblNewLabel.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		stuNameTxt = new JTextField();
    		stuNameTxt.setColumns(10);
    		
    		JLabel lblNewLabel_1 = new JLabel("\u5B66\u751F\u5B66\u9662");
    		lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		stuXueTxt = new JTextField();
    		stuXueTxt.setColumns(10);
    		
    		JLabel lblNewLabel_2 = new JLabel("\u5B66\u751F\u73ED\u7EA7");
    		lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		JLabel lblNewLabel_3 = new JLabel("\u5B66\u751F\u5B66\u53F7");
    		lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		JLabel lblNewLabel_4 = new JLabel("\u5B66\u751F\u6027\u522B");
    		lblNewLabel_4.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    	    manJcb = new JRadioButton("\u7537");
    		
    		femaleJcb = new JRadioButton("\u5973");
    		femaleJcb.setSelected(true);
    		
    		stuIdcardTxt = new JTextField();
    		stuIdcardTxt.setColumns(10);
    		
    		JLabel lblNewLabel_5 = new JLabel("\u5B66\u751F\u5E74\u9F84");
    		lblNewLabel_5.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		stuAgeTxt = new JTextField();
    		stuAgeTxt.setColumns(10);
    		
    		JLabel lblNewLabel_6 = new JLabel("\u8054\u7CFB\u65B9\u5F0F");
    		lblNewLabel_6.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		stuPhoneTxt = new JTextField();
    		stuPhoneTxt.setColumns(10);
    		
    		JLabel lblNewLabel_7 = new JLabel("\u5BB6\u5EAD\u4F4F\u5740");
    		lblNewLabel_7.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		stuAddressTxt = new JTextField();
    		stuAddressTxt.setColumns(10);
    		
    		JButton btnNewButton = new JButton("\u6DFB\u52A0");
    		btnNewButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				studentAddActionPerformed(e);
    				
    			}
    		});
    		
    		JButton btnNewButton_1 = new JButton("\u91CD\u7F6E");
    		btnNewButton_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				studentReseActionPerFormed(e);
    			}
    		});
    		
    		stuTypeidTxt = new JTextField();
    		stuTypeidTxt.setColumns(10);
    		GroupLayout groupLayout = new GroupLayout(getContentPane());
    		groupLayout.setHorizontalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(26)
    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    						.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
    							.addComponent(lblNewLabel_7, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    							.addComponent(lblNewLabel_6, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    							.addComponent(lblNewLabel_4, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    							.addComponent(lblNewLabel_2, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    						.addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE))
    					.addPreferredGap(ComponentPlacement.RELATED)
    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    						.addGroup(groupLayout.createSequentialGroup()
    							.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.RELATED, 336, Short.MAX_VALUE)
    							.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
    						.addGroup(groupLayout.createSequentialGroup()
    							.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    								.addGroup(groupLayout.createSequentialGroup()
    									.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
    										.addComponent(stuPhoneTxt)
    										.addGroup(groupLayout.createSequentialGroup()
    											.addGap(10)
    											.addComponent(manJcb, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)
    											.addPreferredGap(ComponentPlacement.UNRELATED)
    											.addComponent(femaleJcb, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)))
    									.addGap(136))
    								.addGroup(groupLayout.createSequentialGroup()
    									.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    										.addComponent(stuTypeidTxt, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
    										.addComponent(stuNameTxt, GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE))
    									.addGap(35)))
    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    								.addComponent(lblNewLabel_5)
    								.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 73, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_3))
    							.addGap(29)
    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
    								.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    									.addComponent(stuIdcardTxt, 168, 168, 168)
    									.addComponent(stuXueTxt, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))
    								.addComponent(stuAgeTxt, GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)))
    						.addComponent(stuAddressTxt, GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE))
    					.addGap(107))
    		);
    		groupLayout.setVerticalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(28)
    					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    						.addComponent(lblNewLabel_3)
    						.addGroup(groupLayout.createSequentialGroup()
    							.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    								.addComponent(stuXueTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    								.addComponent(lblNewLabel_1)
    								.addComponent(lblNewLabel)
    								.addComponent(stuNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    							.addGap(13)
    							.addComponent(stuIdcardTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
    					.addGap(11)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_2)
    						.addComponent(stuTypeidTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_4)
    						.addComponent(manJcb)
    						.addComponent(femaleJcb)
    						.addComponent(stuAgeTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_5))
    					.addGap(26)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_6)
    						.addComponent(stuPhoneTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(32)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_7)
    						.addComponent(stuAddressTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(78)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton_1)
    						.addComponent(btnNewButton))
    					.addContainerGap(93, Short.MAX_VALUE))
    		);
    		getContentPane().setLayout(groupLayout);
    	 /**
    	 * 调用初始化班级下拉框
    	 */
    		
    		this.fillGradeType();
    
    	}
    	/***
    	 * 学生添加操作
    	 */
    	
    	private void studentAddActionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		String stuName=this.stuNameTxt.getText();
    		String stuXue=this.stuXueTxt.getText();
    		String stuIdcard=this.stuIdcardTxt.getText();
    		String stuAge=this.stuAgeTxt.getText();
    		String stuAddress=this.stuAddressTxt.getText();
    		String stuPhone=this.stuPhoneTxt.getText();
    		String stuTypeid=this.stuTypeidTxt.getText();
    		
    		//判断不为空
    		if(StringUtil.isEmpty(stuName)) {
    			JOptionPane.showMessageDialog(null, "学生姓名不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuXue)) {
    			JOptionPane.showMessageDialog(null, "学生学院不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuIdcard)) {
    			JOptionPane.showMessageDialog(null, "学生学号不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuAge)) {
    			JOptionPane.showMessageDialog(null, "学生年龄不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuAddress)) {
    			JOptionPane.showMessageDialog(null, "家庭住址不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuPhone)) {
    			JOptionPane.showMessageDialog(null, "联系方式不能为空");
    			return;	
    		}
    		if(StringUtil.isEmpty(stuTypeid)) {
    			JOptionPane.showMessageDialog(null, "学生班级不能为空");
    			return;	
    		}
    		
    		//判断用户输入的性别
    		String stuSex=null;
    		if(manJcb.isSelected()) {
    			stuSex="男";	
    		}
    		else if(femaleJcb.isSelected()) {
    			stuSex="女";
    		}
    		Student student =new Student( stuName,  stuXue,  stuIdcard,stuSex,  stuAge,  stuAddress,
    			 stuPhone,  stuTypeid);
    		Connection con=null;
    		try {
    			con=dbUtil.getCon();
    			int addNum=studentDao.add(con, student);
    			if(addNum==1) {
    				JOptionPane.showMessageDialog(null, "学生添加成功");	
    			}else {
    				JOptionPane.showMessageDialog(null, "学生添加失败");
    				
    			}
    		} catch (Exception e1) {
    			// TODO Auto-generated catch block
    			e1.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);
    			} catch (Exception e1) {
    				// TODO Auto-generated catch block
    				e1.printStackTrace();
    			}
    		}
    		
    	}
    
    	/***
    	 * 重置操作
    	 * @param e
    	 */
    	private void studentReseActionPerFormed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		this.resetValue();
    		
    	}
    	public void resetValue() {
    		this.stuNameTxt.setText("");
    		this.stuXueTxt.setText("");
    		this.stuAddressTxt.setText("");
    		this.stuIdcardTxt.setText("");
    		this.stuAgeTxt.setText("");
    		this.stuPhoneTxt.setText("");
    		this.stuTypeidTxt.setText("");
    		
    		
    	}
    	/**
    	 * 
    	 * 初始化班级下拉框
    	 */
    	private void fillGradeType() {
    		Connection con=null;
    		GradeType gradeType=null;
    		try {
    			con=dbUtil.getCon();
    			ResultSet rs=gradeTypeDao.list(con, new GradeType());
    			while(rs.next()) {
    				gradeType=new GradeType();
    				gradeType.setId(rs.getInt("id"));
    				gradeType.setGradeName(rs.getString("gradeName"));
    				
    			}
    		} catch (Exception e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);
    			} catch (Exception e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    			
    	}
    }
    
    
    
    
    
    package hiai.view;
    
    import java.awt.Color;
    import java.awt.EventQueue;
    
    import javax.swing.JInternalFrame;
    import javax.swing.GroupLayout;
    import javax.swing.GroupLayout.Alignment;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    
    import java.awt.Font;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.util.Vector;
    
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.JScrollPane;
    import javax.swing.LayoutStyle.ComponentPlacement;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableModel;
    
    import hiai.dao.GradeTypeDao;
    import hiai.dao.StudentDao;
    import hiai.model.GradeType;
    import hiai.model.Student;
    import hiai.util.DbUTil;
    import hiai.util.StringUtil;
    
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JPanel;
    import javax.swing.border.LineBorder;
    import javax.swing.border.TitledBorder;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    
    public class StudentManageFrm extends JInternalFrame {
    	private JTextField s_studentcardTxt;
    	private JTable studentTypeTable;
    	private DbUTil dbUtil =new DbUTil();
    	private GradeTypeDao gradeTypeDao=new GradeTypeDao();
    	private StudentDao studentDao=new StudentDao();
    	private JTextField studentIdTxt;
    	private JTextField studentNameTxt;
    	private JTextField studentXueTxt;
    	private JTextField studentIdcardTxt;
    	private JTextField studentSexTxt;
    	private JTextField studentAgeTxt;
    	private JTextField studentAddressTxt;
    	private JTextField studentPhoneTxt;
    	private JTextField studentTypeidTxt;
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					StudentManageFrm frame = new StudentManageFrm();
    					frame.setVisible(true);
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frame.
    	 */
    	public StudentManageFrm() {
    		setIconifiable(true);
    		setClosable(true);
    		setTitle("\u5B66\u751F\u7EF4\u62A4");
    		setBounds(100, 100, 752, 560);
    		
    		JLabel lblNewLabel = new JLabel("\u5B66\u751F\u5B66\u53F7");
    		lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 15));
    		
    		s_studentcardTxt = new JTextField();
    		s_studentcardTxt.setColumns(10);
    		
    		JButton btnNewButton = new JButton("\u67E5\u8BE2");
    		btnNewButton.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				studentcardSearchActionPerformed(e);
    			}
    		});
    		btnNewButton.setFont(new Font("宋体", Font.PLAIN, 15));
    		
    		JScrollPane scrollPane = new JScrollPane();
    		
    		JPanel panel = new JPanel();
    		panel.setBorder(new TitledBorder(null, "\u8868\u5355\u64CD\u4F5C", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    		
    		JButton btnNewButton_1 = new JButton("\u4FEE\u6539");
    		btnNewButton_1.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				studentxiugai();
    				
    				
    				
    				
    			}
    		});
    		
    		JButton btnNewButton_2 = new JButton("\u5220\u9664");
    		btnNewButton_2.addActionListener(new ActionListener() {
    			public void actionPerformed(ActionEvent e) {
    				
    				studentdelete(e);
    			}
    		});
    		GroupLayout groupLayout = new GroupLayout(getContentPane());
    		groupLayout.setHorizontalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(62)
    					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
    						.addComponent(panel, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    						.addGroup(Alignment.LEADING, groupLayout.createParallelGroup(Alignment.TRAILING, false)
    							.addComponent(scrollPane, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 629, Short.MAX_VALUE)
    							.addGroup(groupLayout.createSequentialGroup()
    								.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
    								.addGap(32)
    								.addComponent(s_studentcardTxt, GroupLayout.PREFERRED_SIZE, 403, GroupLayout.PREFERRED_SIZE)
    								.addGap(18)
    								.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))))
    					.addContainerGap(49, Short.MAX_VALUE))
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(105)
    					.addComponent(btnNewButton_1, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    					.addPreferredGap(ComponentPlacement.RELATED, 306, Short.MAX_VALUE)
    					.addComponent(btnNewButton_2, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
    					.addGap(135))
    		);
    		groupLayout.setVerticalGroup(
    			groupLayout.createParallelGroup(Alignment.LEADING)
    				.addGroup(groupLayout.createSequentialGroup()
    					.addGap(19)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel)
    						.addComponent(s_studentcardTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(btnNewButton))
    					.addGap(32)
    					.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)
    					.addGap(18)
    					.addComponent(panel, GroupLayout.PREFERRED_SIZE, 196, GroupLayout.PREFERRED_SIZE)
    					.addGap(18)
    					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
    						.addComponent(btnNewButton_1)
    						.addComponent(btnNewButton_2))
    					.addContainerGap(40, Short.MAX_VALUE))
    		);
    		
    		JLabel lblNewLabel_1 = new JLabel("\u5B66\u751F\u7F16\u53F7");
    		
    		studentIdTxt = new JTextField();
    		studentIdTxt.setEditable(false);
    		studentIdTxt.setColumns(10);
    		
    		studentNameTxt = new JTextField();
    		studentNameTxt.setColumns(10);
    		
    		JLabel lblNewLabel_2 = new JLabel("\u5B66\u751F\u59D3\u540D");
    		
    		JLabel lblNewLabel_3 = new JLabel("\u5B66\u751F\u5B66\u9662");
    		
    		studentXueTxt = new JTextField();
    		studentXueTxt.setColumns(10);
    		
    		JLabel lblNewLabel_4 = new JLabel("\u5B66\u751F\u5B66\u53F7");
    		
    		studentIdcardTxt = new JTextField();
    		studentIdcardTxt.setColumns(10);
    		
    		JLabel lblNewLabel_5 = new JLabel("\u5B66\u751F\u6027\u522B");
    		
    		studentSexTxt = new JTextField();
    		studentSexTxt.setColumns(10);
    		
    		JLabel lblNewLabel_6 = new JLabel("\u5B66\u751F\u5E74\u9F84");
    		
    		studentAgeTxt = new JTextField();
    		studentAgeTxt.setColumns(10);
    		
    		JLabel lblNewLabel_7 = new JLabel("\u5B66\u751F\u5730\u5740");
    		
    		studentAddressTxt = new JTextField();
    		studentAddressTxt.setColumns(10);
    		
    		JLabel lblNewLabel_8 = new JLabel("\u8054\u7CFB\u65B9\u5F0F");
    		
    		studentPhoneTxt = new JTextField();
    		studentPhoneTxt.setColumns(10);
    		
    		JLabel lblNewLabel_9 = new JLabel("\u5B66\u751F\u73ED\u7EA7");
    		
    		studentTypeidTxt = new JTextField();
    		studentTypeidTxt.setColumns(10);
    		GroupLayout gl_panel = new GroupLayout(panel);
    		gl_panel.setHorizontalGroup(
    			gl_panel.createParallelGroup(Alignment.LEADING)
    				.addGroup(gl_panel.createSequentialGroup()
    					.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
    						.addGroup(gl_panel.createSequentialGroup()
    							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentIdTxt, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE))
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_4, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentIdcardTxt)))
    							.addGap(18)
    							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentNameTxt, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE))
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_5, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentSexTxt)))
    							.addGap(18)
    							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentXueTxt, GroupLayout.PREFERRED_SIZE, 100, GroupLayout.PREFERRED_SIZE))
    								.addGroup(gl_panel.createSequentialGroup()
    									.addComponent(lblNewLabel_6, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    									.addPreferredGap(ComponentPlacement.RELATED)
    									.addComponent(studentAgeTxt))))
    						.addGroup(gl_panel.createSequentialGroup()
    							.addComponent(lblNewLabel_7, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.RELATED)
    							.addComponent(studentAddressTxt))
    						.addGroup(gl_panel.createSequentialGroup()
    							.addComponent(lblNewLabel_8, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.RELATED)
    							.addComponent(studentPhoneTxt, GroupLayout.PREFERRED_SIZE, 162, GroupLayout.PREFERRED_SIZE)
    							.addGap(44)
    							.addComponent(lblNewLabel_9, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
    							.addPreferredGap(ComponentPlacement.RELATED)
    							.addComponent(studentTypeidTxt)))
    					.addContainerGap(123, Short.MAX_VALUE))
    		);
    		gl_panel.setVerticalGroup(
    			gl_panel.createParallelGroup(Alignment.LEADING)
    				.addGroup(gl_panel.createSequentialGroup()
    					.addContainerGap()
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_1)
    						.addComponent(studentIdTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(studentNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_2)
    						.addComponent(lblNewLabel_3)
    						.addComponent(studentXueTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(28)
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_4)
    						.addComponent(studentIdcardTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_5)
    						.addComponent(studentSexTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_6)
    						.addComponent(studentAgeTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_7)
    						.addComponent(studentAddressTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addGap(18)
    					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
    						.addComponent(lblNewLabel_8)
    						.addComponent(studentPhoneTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
    						.addComponent(lblNewLabel_9)
    						.addComponent(studentTypeidTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
    					.addContainerGap(26, Short.MAX_VALUE))
    		);
    		panel.setLayout(gl_panel);
    		
    		studentTypeTable = new JTable();
    		studentTypeTable.addMouseListener(new MouseAdapter() {
    			@Override
    			public void mousePressed(MouseEvent e) {
    				
    				studentTableMousePressed();
    				
    				
    			}
    		});
    		studentTypeTable.setModel(new DefaultTableModel(
    			new Object[][] {
    			},
    			new String[] {
    				"\u7F16\u53F7", "\u5B66\u751F\u59D3\u540D", "\u5B66\u751F\u5B66\u9662", "\u5B66\u751F\u5B66\u53F7", "\u5B66\u751F\u6027\u522B", "\u5B66\u751F\u5E74\u9F84", "\u5B66\u751F\u5730\u5740", "\u5B66\u751F\u8054\u7CFB\u65B9\u5F0F", "\u5B66\u751F\u73ED\u7EA7"
    			}
    		) {
    			boolean[] columnEditables = new boolean[] {
    				false, true, false, false, false, false, false, false, false
    			};
    			public boolean isCellEditable(int row, int column) {
    				return columnEditables[column];
    			}
    		});
    		studentTypeTable.getColumnModel().getColumn(7).setPreferredWidth(100);
    		scrollPane.setViewportView(studentTypeTable);
    		getContentPane().setLayout(groupLayout);
    		this.fillTable(new Student());
    		//优化文本域边框
    				studentAddressTxt.setBorder(new LineBorder(new Color(127,157,185),1,false));
    	}
    	private void studentdelete(ActionEvent evt) {
    		// TODO Auto-generated method stub
    		String id=studentIdTxt.getText();
    		if(StringUtil.isEmpty(id)) {
    			JOptionPane.showMessageDialog(null, "请选择您要删除的记录");
    			return;
    		}
    		int n=JOptionPane.showConfirmDialog(null, "确定要删除这条记录吗");
    		if(n==0) {
    			Connection con=null;
    			try {
    				con=dbUtil.getCon();
    				int deleteNum=studentDao.delete(con, id);
    				if(deleteNum==1) {
    					JOptionPane.showMessageDialog(null, "删除成功");
    					resetValue();
    					fillTable(new Student());
    				}
    				else {
    					
    					JOptionPane.showMessageDialog(null, "删除失败");
    				}
    			} catch (Exception e1) {
    				// TODO Auto-generated catch block
    				e1.printStackTrace();
    			}finally {
    				try {
    					dbUtil.closeCon(con);//关闭数据库
    				}
    				catch (Exception e1) {
    					// TODO: handle exception
    					e1.printStackTrace();
    				}
    			}
    			
    		}
    	}
    
    	/**
    	 * 修改操作
    	 */
    	private void studentxiugai() {
    		// TODO Auto-generated method stub
    		String id=studentIdTxt.getText();
    		String s_Name=studentNameTxt.getText();
    		String s_Xue=studentXueTxt.getText();
    		String s_Idcard=studentIdcardTxt.getText();
    		String s_Sex=studentSexTxt.getText();
    		String s_Age=studentAgeTxt.getText();
    		String s_Address=studentAddressTxt.getText();
    		String s_Phone=studentPhoneTxt.getText();
    		String s_Typeid=studentTypeidTxt.getText();
    		if(StringUtil.isEmpty(id)) {
    			JOptionPane.showMessageDialog(null, "请选择您要修改的记录");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Name)) {
    			JOptionPane.showMessageDialog(null, "学生名称不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty( s_Xue)) {
    			JOptionPane.showMessageDialog(null, "学生学院不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Idcard)) {
    			JOptionPane.showMessageDialog(null, "学生学号不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Sex)) {
    			JOptionPane.showMessageDialog(null, "学生性别不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Age)) {
    			JOptionPane.showMessageDialog(null, "学生年龄不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Address)) {
    			JOptionPane.showMessageDialog(null, "家庭住址不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty(s_Phone)) {
    			JOptionPane.showMessageDialog(null, "联系方式不能为空");
    			return;
    		}
    		if(StringUtil.isEmpty (s_Typeid)) {
    			JOptionPane.showMessageDialog(null, "学生班级不能为空");
    			return;
    		}
    		
    		Student student=new Student( Integer.parseInt(id), s_Name ,  s_Xue,  s_Idcard,  s_Sex,  s_Age,
    				s_Address, s_Phone, s_Typeid);
    		Connection con=null;
    		try {
    			con=dbUtil.getCon();
    			int mod=studentDao.update(con, student);
    			if(mod==1) {
    				JOptionPane.showMessageDialog(null, "修改成功");
    				resetValue();
    			    fillTable(new Student());   
    			}else {
    				
    				JOptionPane.showMessageDialog(null, "修改失败");
    			}
    		} catch (Exception e1) {
    			// TODO Auto-generated catch block
    			e1.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);
    			} catch (Exception e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    	}
    		
    		
    		
    		/**
    		 * 重置操作
    		 */
    	
    
    	private void resetValue() {
    		// TODO Auto-generated method stub
    		this.studentIdTxt.setText("");
    		this.studentNameTxt.setText("");
    		this.studentXueTxt.setText("");
    		this.s_studentcardTxt.setText("");
    		this.studentSexTxt.setText("");
    		this.studentAgeTxt.setText("");
    		this.studentAddressTxt.setText("");
    		this.studentPhoneTxt.setText("");
    		this.studentTypeidTxt.setText("");
    		
    	}
    
    	/**
    	 * 表格单击事件
    	 */
    	
    	
    	private void studentTableMousePressed() {
    		// TODO Auto-generated method stub
    		
    		int row= studentTypeTable.getSelectedRow();
    		studentIdTxt.setText((String)studentTypeTable.getValueAt(row, 0));
    		studentNameTxt.setText((String)studentTypeTable.getValueAt(row, 1));
    		studentXueTxt.setText((String)studentTypeTable.getValueAt(row, 2));
    		studentIdcardTxt.setText((String)studentTypeTable.getValueAt(row, 3));
    		studentSexTxt.setText((String)studentTypeTable.getValueAt(row, 4));
    		studentAgeTxt.setText((String)studentTypeTable.getValueAt(row, 5));
    		studentAddressTxt.setText((String)studentTypeTable.getValueAt(row, 6));
    		studentPhoneTxt.setText((String)studentTypeTable.getValueAt(row, 7));
    		studentTypeidTxt.setText((String)studentTypeTable.getValueAt(row, 8));
    		
    	}
    
    	
    	/**
    	 * 查询操作
    	 * @param e
    	 */
    	private void studentcardSearchActionPerformed(ActionEvent e) {
    		// TODO Auto-generated method stub
    		String s_studentcard= this.s_studentcardTxt.getText();
    		Student student=new Student();
    		student.setStuIdcarde(s_studentcard);
    		this.fillTable(student);
    		
    		
    	}
    
    	/**
    	 * 初始化表格
    	 */
    	private void fillTable(Student student) {
    		DefaultTableModel dtm=(DefaultTableModel)studentTypeTable.getModel();
    		dtm.setRowCount(0);
    		Connection con=null;
    		
    		try {
    			con=dbUtil.getCon();
    			ResultSet rs=studentDao.list(con, student);
    			//String gradeType=rs.getString("stuTypeid");
    			//System.out.println(gradeType);
    			while(rs.next()) {
    			Vector v=new Vector();
    			v.add(rs.getString("id"));
    			v.add(rs.getString("stuName"));
    			v.add(rs.getString("stuXue"));
    			v.add(rs.getString("stuIdcard"));
    			v.add(rs.getString("stuSex"));
    			v.add(rs.getString("stuAge"));
    			v.add(rs.getString("stuAddress"));
    			v.add(rs.getString("stuPhone"));
    			v.add(rs.getString("stuTypeid"));
    			dtm.addRow(v);
    			
    			}
    			
    		} catch (Exception e1) {
    			// TODO Auto-generated catch block
    			e1.printStackTrace();
    		}finally {
    			try {
    				dbUtil.closeCon(con);
    			} catch (Exception e1) {
    				// TODO Auto-generated catch block
    				e1.printStackTrace();
    			}
    		}
    	}
    }
    	
    	
    
    展开全文
  • 资源下载此资源下载价格为4D币,请先登录资源文件列表codedown123-0830-24/chengjichaxun.html,3085codedown123-0830-24/css/mui.css,94226codedown123-0830-24/css/mui.min.css,73639codedown123-0830-24/css/mui....

    5ca8ed552bdc9ed1de37c92030eab324.png

    资源下载此资源下载价格为4D币,请先登录

    资源文件列表

    codedown123-0830-24/chengjichaxun.html , 3085

    codedown123-0830-24/css/mui.css , 94226

    codedown123-0830-24/css/mui.min.css , 73639

    codedown123-0830-24/css/mui.picker.min.css , 4843

    codedown123-0830-24/css/mui.poppicker.css , 1249

    codedown123-0830-24/css/style.css , 7381

    codedown123-0830-24/css/style.css.map , 5150

    codedown123-0830-24/dianfeichaxun.html , 2275

    codedown123-0830-24/enroll.html , 6913

    codedown123-0830-24/fonts/mui.ttf , 29884

    codedown123-0830-24/img/andy.jpg , 79740

    codedown123-0830-24/img/book.png , 3172

    codedown123-0830-24/img/bukao.png , 3183

    codedown123-0830-24/img/chengji.png , 1443310

    codedown123-0830-24/img/classroom.png , 2257

    codedown123-0830-24/img/dianfei.png , 1341

    codedown123-0830-24/img/electricity.png , 1397

    codedown123-0830-24/img/enroll.png , 397856

    codedown123-0830-24/img/exit.png , 1991

    codedown123-0830-24/img/jacky.jpg , 75038

    codedown123-0830-24/img/keshi.png , 3491

    codedown123-0830-24/img/local_img.jpg , 276337

    codedown123-0830-24/img/room.png , 3696

    codedown123-0830-24/img/school.png , 3620

    codedown123-0830-24/img/timetable.png , 36513

    codedown123-0830-24/img/timg.jpeg , 24412

    codedown123-0830-24/index.html , 2748

    codedown123-0830-24/js/class-data.js , 428

    codedown123-0830-24/js/jquery-1.12.1.min.js , 97403

    codedown123-0830-24/js/mui.js , 229511

    codedown123-0830-24/js/mui.min.js , 112901

    codedown123-0830-24/js/mui.picker.min.js , 16365

    codedown123-0830-24/js/mui.poppicker.js , 4533

    codedown123-0830-24/js/mui.previewimage.js , 13324

    codedown123-0830-24/js/mui.zoom.js , 11703

    codedown123-0830-24/js/time-data.js , 4279

    codedown123-0830-24/keshichaxun.html , 5341

    codedown123-0830-24/payment.html , 2672

    codedown123-0830-24/payment_sub.html , 2075

    codedown123-0830-24/personCenter.html , 2863

    codedown123-0830-24/query_classroom.html , 2170

    codedown123-0830-24/query_dianfei.html , 1996

    codedown123-0830-24/query_keshi.html , 2218

    codedown123-0830-24/query_score.html , 2232

    codedown123-0830-24/rate.html , 2942

    codedown123-0830-24/rate_sub.html , 4712

    codedown123-0830-24/teacherCenter.html , 2841

    codedown123-0830-24/teacherSalary.html , 3474

    codedown123-0830-24/teacher_timetable.html , 6072

    codedown123-0830-24/timetable.html , 3197

    codedown123-0830-24/timetable_new.html , 4914

    codedown123-0830-24/UI_pic/10.pic.jpg , 86427

    codedown123-0830-24/UI_pic/2.pic.jpg , 200558

    codedown123-0830-24/UI_pic/3.pic.jpg , 200491

    codedown123-0830-24/UI_pic/4.pic.jpg , 239402

    codedown123-0830-24/UI_pic/5.pic.jpg , 213087

    codedown123-0830-24/UI_pic/6.pic.jpg , 241950

    codedown123-0830-24/UI_pic/7.pic.jpg , 69735

    codedown123-0830-24/UI_pic/8.pic.jpg , 55827

    codedown123-0830-24/UI_pic/9.pic.jpg , 64258

    codedown123-0830-24/user_bind.html , 4037

    codedown123-0830-24/vote.html , 2605

    在线预览

    展开全文
  • /* * To changethis template, choose Tools |... } } //学生成绩管理系统界面 classmainFrameextends JFrame implements ActionListener { ﻩMenuBar myMenuBar=newMenuBar();//菜单

    /*

    * To changethis template, choose Tools | Templates

    *andopen the template in the editor、

    */

    package studentinfo;

    import java、awt、*;

    import javax、swing、*;

    import java、awt、event、*;

    import java、awt、*;

    import java、awt、event、*;

    import java、util、*;

    importjavax、swing、border、*;

    import javax、swing、JOptionPane;

    import javax、swing、JLabel;

    importjavax、swing、JPanel;

    importjavax、swing、table、DefaultTableModel;

    importjavax、swing、table、TableColumn;

    import java、sql、*;

    import java、awt、GridLayout;//网格式布局

    //导入javar需要得jar包

    public class StudentInfo

    public StudentInfo()//构造方法

    {

    publicstatic void main(String[]args)

    {

    //TODO codeapplicationlogic here

    loginFramelf=new loginFrame();//加载窗体

    lf、setVisible(true);//设置窗体可见

    lf、addWindowListener(new WindowAdapter()//添加窗口监听以接受关闭事件

    publicvoid windowClosing(WindowEvent e)

    System、exit(0);

    });

    }

    //学生成绩管理系统界面

    classmainFrameextends JFrame implements ActionListener

    {

    ﻩMenuBar myMenuBar=newMenuBar();//菜单

    展开全文
  • 第 1 楼CCCandy发表于: 2020-09-07 18:19 00你好我下载了你的实例,有些问题需要请教你一下第 2 楼CCCandy发表于: 2020-09-07 18:19 31你好我下载了你的实例,有些问题需要请教你一下,QQ:3353459453第 3 楼CCCandy...

    第 1 楼CCCandy发表于: 2020-09-07 18:19 00

    你好我下载了你的实例,有些问题需要请教你一下

    第 2 楼CCCandy发表于: 2020-09-07 18:19 31

    你好我下载了你的实例,有些问题需要请教你一下,QQ:3353459453

    第 3 楼CCCandy发表于: 2020-09-07 18:28 22

    你好你的实例在使用过程中出现了一些问题,可以加QQ说明一下吗?QQ:3353459453

    第 4 楼CCCandy发表于: 2020-09-07 18:33 09

    你好我下载了你的实例,有些问题需要请教你一下,QQ:3353459453

    第 5 楼CCCandy发表于: 2020-09-08 12:49 39

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 12:37:45

    Line no.:21

    Error Code: 1046 - No database selected

    连接你的数据库的时候出现了这个错误,可以解答一下吗

    QQ:3353459453

    第 6 楼CCCandy发表于: 2020-09-08 13:19 47

    Query:

    INSERT INTO `student` VALUES ('10', '201301010', '娜菲鲁塔利薇薇', '女', '11452356234', '235345', 0x70686F746F2F73747564656E742E6A7067, '1', '1')

    Error occured at:2020-09-08 12:59:59

    Line no.:463

    Error Code: 1406 - Data too long for column 'name' at row 1

    连接你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 7 楼CCCandy发表于: 2020-09-08 13:19 51

    Query:

    INSERT INTO `student` VALUES ('10', '201301010', '娜菲鲁塔利薇薇', '女', '11452356234', '235345', 0x70686F746F2F73747564656E742E6A7067, '1', '1')

    Error occured at:2020-09-08 12:59:59

    Line no.:463

    Error Code: 1406 - Data too long for column 'name' at row 1

    连接你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 8 楼CCCandy发表于: 2020-09-08 13:19 55

    Query:

    INSERT INTO `student` VALUES ('10', '201301010', '娜菲鲁塔利薇薇', '女', '11452356234', '235345', 0x70686F746F2F73747564656E742E6A7067, '1', '1')

    Error occured at:2020-09-08 12:59:59

    Line no.:463

    Error Code: 1406 - Data too long for column 'name' at row 1

    连接你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 9 楼CCCandy发表于: 2020-09-08 13:20 08

    Query:

    INSERT INTO `student` VALUES ('10', '201301010', '娜菲鲁塔利薇薇', '女', '11452356234', '235345', 0x70686F746F2F73747564656E742E6A7067, '1', '1')

    Error occured at:2020-09-08 12:59:59

    Line no.:463

    Error Code: 1406 - Data too long for column 'name' at row 1

    连接你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 10 楼CCCandy发表于: 2020-09-08 13:20 36

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 11 楼CCCandy发表于: 2020-09-08 13:20 41

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 12 楼CCCandy发表于: 2020-09-08 13:20 43

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 13 楼CCCandy发表于: 2020-09-08 13:20 45

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 14 楼CCCandy发表于: 2020-09-08 13:20 47

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    第 15 楼CCCandy发表于: 2020-09-08 13:20 48

    Query:

    DROP TABLE IF EXISTS `clazz`

    Error occured at:2020-09-08 13:09:47

    Line no.:21

    Error Code: 1046 - No database selected

    你的数据库的时候出现了这个错误,可以解答一下吗 QQ:3353459453

    展开全文
  • 学生信息管理系统java课程设计(含源代码)》由会员分享,可在线阅读,更多相关《学生信息管理系统java课程设计(含源代码)(43页珍藏版)》请在人人文库网上搜索。1、JAVA程序设计 课程设计报告课 题: 学生信息管理...
  • 学生选课课程管理系统,有7张数据库表构成,系统有四种用户角色,分别是管理员、院长、教师、学生。不同的角色有不同的权限和功能。系统功能全面,模拟大学生手法编写代码代码简单可读性强,有增删改查等基本操作...
  • - III -- III -中国海洋大学青岛学院C语言课程设计报告书题 目学生信息管理系统学生姓名指导教师学 院专业班级组内分工姓名主要任务占系统比例学生信息的查看,主函数,退出35%学生信息的删除,菜单25%学生信息的...
  • 数据结构 课程设计源代码设计题目: 学生宿舍管理系统院 系: 计算机学院班 级: 软件1501组 别: 六组 长: 周佳理组 员: 韩壮壮 陈义安起止日期: 2016年12月20日~2016年12月24日指导教师: 韩丽娜源代码:#d...
  • 学生管理系统(数据结构课程设计之完整代码)》由会员分享,可在线阅读,更多相关《学生管理系统(数据结构课程设计之完整代码)(14页珍藏版)》请在人人文库网上搜索。1、数据结构课程设计学生信息管理系统C语言编写 ...
  • C&C++期末课程设计——学生成绩管理系统,这个程序是用C++&C语言程序编写的,运行环境为VisualC++ 6.0,实现了学生成绩的管理功能:输入课程信息、输入学生信息成绩、学生基本情况查询、成绩查询、删除信息等等!...
  • 学生信息管理系统java课程设计(含源代码).doc还剩42页未读,继续阅读下载文档到电脑,马上远离加班熬夜!亲,很抱歉,此页已超出免费预览范围啦!如果喜欢就下载吧,价低环保!内容要点:- 42 -//******************...
  • java课程设计(学生信息管理系统

    千次阅读 2021-02-12 17:44:09
    2.本组课题及本人任务本组的课题是学生信息管理系统,我负责的任务是完成学生信息管理系统的图形界面。3.总体设计(概要设计)本组完成的是学生信息管理系统,主要的功能有增,删,查,改,管理的学生信息有学号、姓名...
  • 主要是做了一个社团管理系统。 使用技术主要是前端:html+css+js 模板采用ejs 后端使用node+express 数据存储使用了leancloud。做毕业设计,课程设计或者正在学习相关技术知识的朋友可以下载资源学习。想继续学习...
  • 一份C语言学生成绩管理系统设计报告,分享给大家一、课程设计题目《学生成绩管理系统设计》二、实训目的(1)掌握结构化程序设计的基本方法,基本掌握面向对象程序设计的基本思路和方法。(2)掌握C++的基本概念和基础...
  • 本文实例为大家分享了学生信息管理系统设计的具体代码,供大家参考,具体内容如下建立一个动态链表,链表中每一结点包括:学号、姓名、性别、年龄、成绩。程序能实现以下功能:建立链表显示链表查找链表中是否存在...
  • C语言学生信息管理系统代码

    千次阅读 多人点赞 2020-12-22 10:21:36
    大学C语言实训课学习到的一段源代码,C语言学生信息管理系统。 #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> struct stu_inf//学生信息结构体定义 { int...
  • 数据库学生成绩管理系统课程设计报告 数据库课程设计报告1.功能需求 本报告主要介绍学生成绩管理系统的数据库设计,从需求分析到数据库的运行与维护都 进行详细的叙述。该系统是利用 SQL 开发出来的。通过 SQL 建立...
  • void SystemDlg::OnClose(){// TODO: 在此添加消息处理程序代码和/或调用默认值CDialog* dplg = (CDialog*)AfxGetMainWnd(); // 获得子窗口的指针dplg->DestroyWindow(); // 利用指针是操作子窗口(自我销毁)...
  • (学号自动生成且唯一)查询学生成绩:每个人都有数学、Java与体育与选修课查询学生课程进行公选课选课教师管理系统添删改学生功能查找学生(姓名查找(支持模糊查找),学号查找,班级查找,科目查找)进行学生成绩分析...
  • 满意答案slgmm2016.04.13采纳率:49%等级:8已帮助:2113人#include#include#include#define N 8char name[N][N*2];char sex[N/4];int number[N];int jugment(char *dest,int size){fgets(dest,size,stdin);...
  • 455ss百度文库理学院Shoole of Sciences课程设计报告设计名称:综合训练学生姓名:xxxxx学生学号:xxxxx所在班级:xxxxx所在专业:信息与计算科学指导教师:xxxxxx设计场所:理学院机房设计时间:第七学期课程设计...
  • 这个是我大三上学期的时候刚开始学习数据库课程的时候做的一个很稀烂的课程设计的源代码,当时刚刚开始学习Java和Oracle,而且当时就花了今年元旦3天假,做的这个C/S程序中没有加入触发器和存储过程等高级PL/SQL编程...
  • 系统代码一、登录界面代码usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;...
  • C语言课程设计---学生信息管理系统设计兰州交通大学(二)模块设计模块一:头文件,变量定义,函数声明对系统所是用的变量进行定义、对函数进行声明模块二:学生信息系统使用帮助声明函数void help(),对整个系统进行...
  • 23 private void 学生信息ToolStripMenuItem_Click(objectsender, EventArgs e)24 {25 ds = sqlhelper.ExecuteDataSet("select * from tb_student");26 dt = ds.Tables[0];27 dataGridView1.DataSource =dt;28 }29 ...
  • 学生成绩管理系统.rar

    2021-03-17 12:38:53
    压缩包 : 学生成绩管理系统.rar 列表学生课绩管理系统学生课绩管理系统\backup_ClassDB.BAK学生课绩管理系统\test学生课绩管理系统\test\AddClass.jsp学生课绩管理系统\test\addClass_confirm.jsp学生课绩管理系统\...
  • 主要功能说明: 管理员角色包含以下功能:管理员登录,学生管理,教师管理,课程管理等功能。 教师角色包含以下功能:登录界面,查看课程,建立课程计划,管理教学课程,成绩查询结课等功能。 学生角色包含以下功能:登录...
  • 本文实例为大家分享了C++学生成绩管理系统的具体代码,供大家参考,具体内容如下* (程序头部注释开始)* 程序的版权和版本声明部分* Copyright (c) 2011, 烟台大学计算机学院学生* All rights reserved.* 文件名称: ...
  • 学生信息管理系统java课程设计报告

    千次阅读 2021-03-11 10:44:30
    学生信息管理系统java课程设计报告 Java面向对象程序课程设计报告——-学生信息管理系统姓名:刘杏娟专业:信息管理与信息系统班级:1130601学号:201130060117指导老师:司红伟2014/6/24前 言随着计算机科学的发展...
  • 添加Label标签控件,用于单行文本显示"学生成绩管理系统";添加三个Button按钮控件,将其分别与关联函数lambda: TeacherRegister、lambda: TeacherLogin、window.destroy绑定;在主事件循环中等待用户触发事件响应。...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 43,672
精华内容 17,468
关键字:

学生课程管理系统代码