文档详情

基于java昆虫科普信息设计实现

hh****pk
实名认证
店铺
DOCX
457.50KB
约72页
文档ID:342896078

—需求分析 11.1. 用户需求: 11.2. 系统功能需求: 11.3系统性能需求 11.4系统软硬件环境确定 1二系统功能设计 22. 1系统功能结构 22. 2系统功能处理流程 2三系统数据库设计 33. 1数据库概念设计(E-R图) 33. 1. 1 用户表(users) 33. 1.2 管理员表(admin) 33.1.3 昆虫简介(summary) 33.1.4 昆虫信息(i nsect) 33. 2数据库逻辑设计 43. 3数据库物理设计 43. 3. 1 管理员(admin) 43. 3. 2 用户表(users) 53. 3. 3 昆虫纲 目表(summary) 53.3.4 昆虫信息(insect) 5四' 系统实现 54. 1数据库连接的实现 54. 2用户登录功能的实现 64. 3用户可以查看昆虫的分类以及纲目的简介功能的实现 124. 4用户查询,添加,更新以及清空功能的实现 134. 5管理员删除能的实现 22五总结 24一需求分析1.1. 用户需求:为了增强同学们对昆虫的认识,使同学们对生活中的昆虫有一个更好的了 解,现决定完成此昆虫科普信息系统。

1.2, 系统功能需求:1) .列出昆虫纲的几大目,并做简介;2) .查询功能:输入昆虫名字,可以查询该昆虫的信息;3) .更新功能:可以新添昆虫的种类;4) .删除功能:可以删除昆虫的信息;5) .修改功能:可以修改昆虫的信息;1.3系统性能需求能够对系统进行定期维护,对用户表只能进行添加注册,昆虫表可以进行修改删 除,科目表则只能进行在程序中显示1.4系统软硬件环境确定软件:运用java语言,通过jdbc桥接mysql,使用lomboz eclipse为开发环境硬件:主存2G,硬盘存储10运行环境:windows xp及以上系统系统功能设计2. 1系统功能结构1) .欢迎界面:包括菜单栏和“进入昆虫世界”的按钮;2) .登录:点击菜单栏和右下角的“进入昆虫世界”按钮均为登录,需要输入用 户名才可进行登录;3) .科目简介:包括昆虫纲的总结介绍,昆虫纲一下所属目的介绍;4) .菜单栏编辑:可以通过菜单栏进入对昆虫信息的查看(包括的昆虫的名字, 分布,简介以及所属科目),查找(通过昆虫名字进行搜索),添加(新昆虫的 信息)以及删除(需要登录超级管理员权限);2. 2系统功能处理流程三系统数据库设计3. 1数据库概念设计(E-R图)3. 1. 1 用户表(users)3. 2数据库逻辑设计3. 3数据库物理设计3. 3. 1 管理员(admin)此表存储管理员的登陆信息。

物理结构为:名 察恩Qidvarchar200□secretvarchar200□prismallint20□3. 3. 2 用户表(users)此表存储用户登录的信息物理结构为:名察允许namevarchar200□ 加secretvarchar200□ >23. 3. 3昆虫纲目表(summary)此表存储昆虫纲目的基本信息物理结构为:名允► kindvarchar200□ 於1sumlongtext0003. 3. 4 昆虫信息(insect)此表存储各种昆虫的详细信息物理结构为:名允► namevarchar100□ 於1distributionlongtext000introlongtext000belongvarchar100H四、系统实现4. 1数据库连接的实现public static Connection getConn() (Connection conn = null;try (Class.forName("com.mysql.jdbc.DriverH);conn = DriverManager.getConnection("jdbc:mysql://localhost/insect_system?user=root&password=root} catch (ClassNotFoundException e) (e.printStackTrace();} catch (SQLException e) (e.printStackTrace();)return conn;4. 2用户登录功能的实现用户通过该窗体进行登陆,首先输入用户名与密码,通过在数据库中的users表 中进行查询是否有此用户名,输入正确则进入系统,否则无反应。

用户登录分为 普通用户和管理员登录,删除时候需要管理员登录另外普通用户可进行注册 用户登陆:用户注册:经理登陆:用户注册代码:public class UserReg extends JFrame(private static final long serialVersionUID = IL;/***用户注册*/static JCoolButton creg =new JCoolButton();static JTextArea areg =new JTextArea();static JPasswordField alog =new JPasswordField();static JLabel treg = new JLabel();static JLabel tlog = new JLabel();public void launchFrame() (JPanel jp = new JPanel();jp.setLayout(null);jp.setBackground(Color.LIGHT_GRAY);setTitle(n用户注册,setLocation(428, 250);setSize(320, 240);setVisible(true);treg.setText(n 用户名:,treg.setBounds(30, 40, 100, 20);tlog.setText("密码:”);tlog.setBounds(30, 90, 100, 20);areg.setBounds(l 10, 40, 150, 20);alog.setBounds(110, 90, 150, 20);creg.setBounds(150, 160, 100, 20);creg. setText(”确定,creg.addActionListener(new ActionListener()(@ Suppres s Warnings (" deprecation ”)public void actionPerformed(ActionEvent argO) (String getid = areg.getText();String getsecret = alog.getText();DB.save(getid, getsecret);dispose();}});jp.add(treg);jp.add(tlog);jp.add(areg);jp.add(alog);jp.add(creg);this.add(jp);}}用户登录代码:public class UserLogin extends JFrame (private static final long serialVersionUID = IL;/***用户登陆*/static JCoolButton creg = new JCoolButton();static JCoolButton clog = new JCoolButton();static JTextArea areg = new JTextArea();static JPasswordField alog = new JPasswordField();static JLabel treg = new JLabel();static JLabel tlog = new JLabel();public void launchFrame() (JPanel jp = new JPanel();j p.setLayout(null);jp.setB ackground(Color.LIGHT_GRAY);setTitle(n用户登陆,setLocation(428, 250);setSize(320, 240);setVisible(true);treg.setText(n 用户名:, treg.setBounds(30, 40, 100, 20);tlog.setText("密码:”);tlog.setBounds(30, 90, 100, 20);areg.setBounds(l 10, 40, 150, 20);alog.setBounds(110, 90, 150, 20);creg.setBounds(40, 160, 100, 20);creg.setText(n 注册”);creg.addActionListener(new ActionListener() (public void actionPerformed(ActionEvent e) ( new UserReg().launchFrame();}});clog.setBounds(180, 160, 100, 20);clog. setText(” 登陆,clog. addActionListener(logAct);jp.add(treg);jp.add(tlog);jp.add(areg);jp.add(alog);jp.add(creg);jp.add(clog);this.add(jp);}private ActionListener logAct = new ActionListener() ( public void actionPerfdrmed(ActionEvent e) (String selename = areg.getText();String selesecret = alog.getText();if (DB.selectname(selesecret).equals(selename)&& DB. selectsecret(selename) .equals(selesecret)) ( new Summary().launchFrame();dispose();};}管理员登录代码:public class Super Admin extends JFrame (private static final long serialVersionUID = IL;/***用户登陆。

下载提示
相似文档
正为您匹配相似的精品文档