您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 数据库 > 数据库课程设计——户籍管理系统(由JAVA编写-附源代码)
户籍管理系统(由JAVA编写)软件支持:本软件开发是在eclipse-SDK-3.2-win32集成环境下编辑、调试与运行的;(Java语言编写,需要装JDK)设备支持:WindowsXP,512内存;数据库:MicrosoftSQLServer2000系统管理员:(仅一个)帐号:admin密码:admin123普通用户:(可由管理员创建)帐号:huang密码:huang本系统主程序为:DengLu.java,编译后运行bin文件夹下的DengLu.class文件即可运行主程序,弹出登录界面:主界面:查看户口信息:查看户成员信息浏览户口信息添加户口信息修改户口信息删除户口信息:查询居民信息:浏览全部居民信息:添加居民信息:修改居民信息:删除居民信息:浏览所有用户信息:添加用户:删除用户:源代码:DengLu.javaimportjavax.swing.JOptionPane;importjavax.swing.SwingUtilities;importjavax.swing.JPanel;importjavax.swing.JFrame;importjavax.swing.JButton;importjava.awt.Rectangle;importjavax.swing.JLabel;importjavax.swing.ImageIcon;importjavax.swing.JTextField;importjavax.swing.JPasswordField;importjava.awt.*;importjava.awt.event.KeyEvent;publicclassDengLuextendsJFrame{privatestaticfinallongserialVersionUID=1L;privateJPaneljContentPane=null;privateJButtonjButton=null;privateJButtonjButton1=null;privateJLabeljLabel=null;privateJTextField用户名=null;privateJPasswordField密码=null;privateJLabeljLabel1=null;privateJLabeljLabel2=null;privateDBOperationdb=newDBOperation();//@jve:decl-index=0:privateinti=0;privateJButtonjButton2=null;/***ThismethodinitializesjButton**@returnjavax.swing.JButton*/privateJButtongetJButton(){if(jButton==null){jButton=newJButton();jButton.setBounds(newRectangle(169,227,70,23));jButton.setMnemonic(KeyEvent.VK_ENTER);jButton.setToolTipText(输入用户名、密码登陆);jButton.setText(登录);jButton.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEvente){Stringuser=用户名.getText();Stringpassword=newString(密码.getPassword());if(user.equals())JOptionPane.showMessageDialog(null,用户名不能为空!);else{if(db.CheckUser(user,password)){if(db.IsAdmin(user)){MainMenum=newMainMenu();m.setVisible(true);setVisible(false);}else{MainMenuUserm=newMainMenuUser();m.setVisible(true);setVisible(false);}}else{JOptionPane.showMessageDialog(null,用户名不存在或密码错误!+剩余次数:+(2-i));i++;if(i=3){JOptionPane.showMessageDialog(null,用户名密码尝试次数已达3次,系统将退出!);System.exit(0);}}}}});}returnjButton;}/***ThismethodinitializesjButton1**@returnjavax.swing.JButton*/privateJButtongetJButton1(){if(jButton1==null){jButton1=newJButton();jButton1.setBounds(newRectangle(263,227,70,23));jButton1.setToolTipText(退出系统);jButton1.setText(退出);jButton1.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEvente){System.exit(0);}});}returnjButton1;}/***Thismethodinitializes用户名**@returnjavax.swing.JTextField*/privateJTextFieldget用户名(){if(用户名==null){用户名=newJTextField();用户名.setBounds(newRectangle(227,158,110,23));}return用户名;}/***Thismethodinitializes密码**@returnjavax.swing.JPasswordField*/privateJPasswordFieldget密码(){if(密码==null){密码=newJPasswordField();密码.setBounds(newRectangle(227,198,110,23));}return密码;}/***ThismethodinitializesjButton2**@returnjavax.swing.JButton*/privateJButtongetJButton2(){if(jButton2==null){jButton2=newJButton();jButton2.setBounds(newRectangle(346,160,63,19));jButton2.setText(注册);jButton2.addActionListener(newjava.awt.event.ActionListener(){publicvoidactionPerformed(java.awt.event.ActionEvente){Zhucez=newZhuce();z.setVisible(true);//setVisible(false);}});}returnjButton2;}/***@paramargs*/publicstaticvoidmain(String[]args){//TODO自动生成方法存根SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){DengLuthisClass=newDengLu();thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);thisClass.setVisible(true);}});}/***Thisisthedefaultconstructor*/publicDengLu(){super();initialize();}/***Thismethodinitializesthis**@returnvoid*/privatevoidinitialize(){this.setContentPane(getJContentPane());this.setSize(600,400);this.setResizable(false);this.setTitle(登录到户籍管理系统);//得到当前屏幕大小this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();//得到frame的大小DimensionframeSize=this.getSize();if(frameSize.heightscreenSize.height){frameSize.height=screenSize.height;}if(frameSize.widthscreenSize.width){frameSize.width=screenSize.width;}//设置frame在屏幕上显示的位置this.setLocation((screenSize.width-frameSize.width)/2,(screenSize.height-frameSize.height)/2);}/***ThismethodinitializesjContentPane**@returnjavax.swing.JPanel*/privateJPanelgetJContentPane(){if(jContentPane==null){jLabel2=newJLabel();jLabel2.setBounds(newRectangle(0,0,600,400));//jLabel2.setIcon(newImageIcon(getClass().getResource(/DengLu.jpg)));jLabel2.setText();jLabel1=newJLabel();jLabel1.setBounds(newRectangle(167,198,58,23));jLabel1.setText(密码:);jLabel=newJLabel();jLabel.setBounds(newRectangle(167,158,58,23));jLabel.setText(用户名:);jContentPane=newJPanel();jContentPane.setLayout(null);jContentPane.add(getJButton(),null);jContentPane.add(getJButton1(),null);jContentPane.add(getJButton2(),null);jContentPane.add(jLabel,null);jContentPane.add(get用户名(),null);jContentPane.add(get密码(),null);jContentPane.add(jLabel1,null);jContentPane.add(jLabel2,null);}returnjContentPane;}}//@jve:decl-index=0:visual-constraint=129,34*************************************************************MainMenu.javaimportjava.awt.Rectangle;importjava.awt.Toolkit;importjavax.swing.JPane
本文标题:数据库课程设计——户籍管理系统(由JAVA编写-附源代码)
链接地址:https://www.777doc.com/doc-5985930 .html