您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > java学生通讯录实验报告
河南教育学院Java课题研究报告设计名称:软件课程设计设计题目:学生通讯录管理系统专业班级:12软件技术学生姓名:岳文娟冯君李晓宁学生成绩:指导教师(职称):王泽民Java程序设计课程设计实验报告小组成员:组长:李晓宁组员:岳文娟冯君任务分工:岳文娟、冯君代码和类的编写、修改;李晓宁数据库的建立;最后三人运行程序调试成功。一:实验目的本《学生信息管理系统》具有对学生信息进行管理的功能。并于数据库相连接,能够对学生的姓名、qq、手机号进行查询、添加和删除等,简捷方便,容易使用。二:实验内容1:程序运行中在主页面中显示出登录、退出、查询、新增、修改、删除通讯录信息。2:在通讯录页面信息里包括姓名、电话、QQ,可按姓名查询、电话号码查询也可以用QQ号进行查询,还可以模糊查询。三:实验需求1:系统的登录;2:学生信息基本的管理包括:姓名、电话、QQ。3:学生个人通讯录保存个人信息,包括姓名、电话、QQ,可以新增、查询、删除联系人。四:数据库建立和链接1:用NavicatforMysql连接java程序,在项目中加载包mysql-connector-java-5.1.15-bin2:在Navicat中的数据库为tongxunlu,表txl、user五:运行代码主代码:Login.Javaimportjavax.swing.JFrame;importjavax.swing.JButton;importjavax.swing.JOptionPane;importjavax.swing.JPasswordField;importjavax.swing.JTextField;importjavax.swing.JLabel;importjava.awt.event.ActionListener;importjava.awt.event.ActionEvent;importjava.util.Map;publicclassLogin{publicJFrameframe;privateJTextFieldt_username;privateJPasswordFieldt_password;publicLogin(){initialize();}privatevoidinitialize(){frame=newJFrame();frame.setTitle(用户登录);frame.setBounds(100,100,450,300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.getContentPane().setLayout(null);JButtonbtnNewButton=newJButton(登录);btnNewButton.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){Stringusername=t_username.getText();char[]password=t_password.getPassword();if(username==null||.equals(username)){JOptionPane.showMessageDialog(null,请输入用户名,提示,JOptionPane.WARNING_MESSAGE);t_username.requestFocus();return;}if(password==null||password.length==0){JOptionPane.showMessageDialog(null,请输入密码,提示,JOptionPane.WARNING_MESSAGE);t_password.requestFocus();return;}//登录if(TxlService.isLogin(username,newString(password))){//保存用户信息TongXunLustu=newTongXunLu();stu.frame.setVisible(true);frame.setVisible(false);}else{JOptionPane.showMessageDialog(null,用户名或密码错误,提示,JOptionPane.WARNING_MESSAGE);t_username.setText();t_password.setText();t_username.requestFocus();}}});btnNewButton.setBounds(120,135,90,25);frame.getContentPane().add(btnNewButton);JButtonbtnNewButton_1=newJButton(取消);btnNewButton_1.setBounds(250,135,90,25);btnNewButton_1.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){}});frame.getContentPane().add(btnNewButton_1);JLabellblNewLabel=newJLabel(用户名:);lblNewLabel.setBounds(73,37,80,15);frame.getContentPane().add(lblNewLabel);t_username=newJTextField(20);t_username.setBounds(137,34,220,27);frame.getContentPane().add(t_username);JLabellabel=newJLabel(密码:);label.setBounds(73,69,80,15);frame.getContentPane().add(label);t_password=newJPasswordField(12);t_password.setBounds(137,65,220,27);frame.getContentPane().add(t_password);}}类:TongxunluMain.javaimportjava.awt.EventQueue;publicclassTongxunluMain{publicstaticvoidmain(String[]args){EventQueue.invokeLater(newRunnable(){publicvoidrun(){try{Loginwindow=newLogin();window.frame.setVisible(true);}catch(Exceptione){e.printStackTrace();}}});}}类:TongXunLu.javaimportjava.awt.EventQueue;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.sql.ResultSet;importjavax.swing.JFrame;importjavax.swing.JButton;importjavax.swing.JLabel;importjavax.swing.JOptionPane;importjavax.swing.JScrollPane;importjavax.swing.JTable;importjavax.swing.JTextField;importjavax.swing.table.DefaultTableModel;publicclassTongXunLu{publicJFrameframe;privateDefaultTableModeltable;privateJTablejtable;privateJLabellname;privateJTextFieldtname;privateJLabellqq;privateJTextFieldtqq;privateJLabellphone;privateJTextFieldtphone;String[]col={姓名,QQ,电话};publicstaticvoidmain(String[]args){EventQueue.invokeLater(newRunnable(){publicvoidrun(){try{TongXunLuwindow=newTongXunLu();window.frame.setVisible(true);}catch(Exceptione){e.printStackTrace();}}});}publicTongXunLu(){initialize();}privatevoidinitialize(){frame=newJFrame();frame.setTitle(学生通讯录管理);frame.setBounds(100,100,650,360);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.getContentPane().setLayout(null);jtable=newJTable();jtable.setBounds(80,50,500,150);table=newDefaultTableModel(col,0);JScrollPanescrollPane=newJScrollPane(jtable);scrollPane.setBounds(80,80,500,180);frame.getContentPane().add(scrollPane);lname=newJLabel(姓名:);lname.setBounds(80,50,40,20);frame.getContentPane().add(lname);tname=newJTextField();tname.setBounds(120,50,100,20);frame.getContentPane().add(tname);lqq=newJLabel(QQ:);lqq.setBounds(230,50,40,20);frame.getContentPane().add(lqq);tqq=newJTextField();tqq.setBounds(260,50,100,20);frame.getContentPane().add(tqq);lphone=newJLabel(电话:);lphone.setBounds(380,50,40,20);frame.getContentPane().add(lphone);tphone=newJTextField();tphone.setBounds(420,50,100,20);frame.getContentPane().add(tphone);JButtonbtnNewButton_2=newJButton(查询);btnNewButton_2.setBounds(80,20,80,23);btnNewButton_2.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){loadInfo();}});frame.getContentPane().add(btnNewButton_2);JButtonbtnNewButton_0=newJButton(新增);btnNewButton_0.setBounds(180,270,80,23);btnNewButton_0.addActionListener(newActionListener(){publicvoidactionPerformed(
本文标题:java学生通讯录实验报告
链接地址:https://www.777doc.com/doc-7331303 .html