在好例子网,分享、交流、成长!
您当前所在位置:首页Java 开发实例Java数据库编程 → BMS-图书管理系统源码(含数据库脚本)

BMS-图书管理系统源码(含数据库脚本)

Java数据库编程

下载此实例
  • 开发语言:Java
  • 实例大小:16.18M
  • 下载次数:33
  • 浏览次数:479
  • 发布时间:2020-02-21
  • 实例类别:Java数据库编程
  • 发 布 人:老衲满头秀发
  • 文件格式:.rar
  • 所需积分:4

实例介绍

【实例简介】管理员账号:2020,密码:12345;学生端账号:2021,密码:12345

管理端 

①管理员和学生不同的管理等级进行登录系统 

②管理员可以实现学生注册的管理,统一注册,统一注销等等,值得一提的是,这个地方使用了Excel技术,支持管理员通过Excel文件进行导入注册,同时支持所有用户的信息进行Excel文件的导出。技术大同小异,所以感兴趣的同学可以在书本借阅的界面增加同样的功能,导入导出的工具类我已经在项目中写出来。 

③管理员可进行图书的增加和删除,修改等等操作。以及图书类型的增删改查。 

④管理员端的借阅统计功能可以借鉴用户界面的功能实现,由于接下来的任务比较重,所以,并没有完成,等着感兴趣的小伙伴完成。但是在用户界面统计功能算是完成的。 

学生端 ①借书和还书功能 ②借书超时罚款 ③修改密码 ④统计分析 等等 更多的功能来看看下面的截图吧 截图部

【实例截图】

from clipboard

from clipboardfrom clipboardfrom clipboard

from clipboard

from clipboard

from clipboard

from clipboard

from clipboard

from clipboard

【核心代码】

/**  
* @Title: logOnFrm.java  
* @Package com.view  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 忘山  
* @date 2020年2月9日  
* @version V1.0  
*/  
package com.view;

import java.awt.Color;
import java.awt.Desktop;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

import com.dao.userDao;
import com.model.User;
import com.util.DbUtil;
import com.util.StringUtil;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**  
* @ClassName: logOnFrm  
* @Description: TODO(管理员登录界面)  
* @author 忘山  
* @date 2020年2月9日  
*  @类说明:
*  
*/
public class logOnFrm extends JFrame {

private JPanel contentPane;
private JTextField userIDText;
private JPasswordField passwordField;

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/Bookicon.png")));
setTitle("BMS-\u767B\u5F55\u754C\u9762");
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 757, 560);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);

JLabel lblBookmanagersystem = new JLabel("BookManagerSystem");
lblBookmanagersystem.setIcon(new ImageIcon(logOnFrm.class.getResource("/images/book.png")));
lblBookmanagersystem.setFont(new Font("微软雅黑", Font.BOLD, 27));

JLabel lblNewLabel = new JLabel("\u7528\u6237ID\uFF1A");
lblNewLabel.setIcon(new ImageIcon(logOnFrm.class.getResource("/images/user.png")));
lblNewLabel.setFont(new Font("微软雅黑", Font.BOLD, 20));

JLabel lblNewLabel_1 = new JLabel("  \u5BC6   \u7801\uFF1A");
lblNewLabel_1.setIcon(new ImageIcon(logOnFrm.class.getResource("/images/password.png")));
lblNewLabel_1.setFont(new Font("微软雅黑", Font.BOLD, 20));

userIDText = new JTextField();
userIDText.setFont(new Font("微软雅黑", Font.PLAIN, 20));
userIDText.setColumns(10);

JButton login = new JButton("\u767B\u5F55");
login.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
LoginActionPerformed(event);
}
});
login.setBackground(UIManager.getColor("Button.background"));
login.setFont(new Font("微软雅黑", Font.BOLD, 20));
login.setIcon(new ImageIcon(logOnFrm.class.getResource("/images/login.png")));

JButton refresh = new JButton("\u91CD\u7F6E");
refresh.setBackground(UIManager.getColor("Button.background"));
refresh.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
refreshActionPerformed(event);
}
});
refresh.setFont(new Font("微软雅黑", Font.BOLD, 20));
refresh.setIcon(new ImageIcon(logOnFrm.class.getResource("/images/refrsh.png")));

passwordField = new JPasswordField();
passwordField.setFont(new Font("微软雅黑", Font.PLAIN, 20));

JLabel label = new JLabel("\u7CFB\u7EDF\u6982\u8FF0");
label.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent arg0) {
openURL();
}
});
label.setForeground(Color.BLUE);
label.setFont(new Font("微软雅黑", Font.PLAIN, 20));
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(175)
.addComponent(lblBookmanagersystem))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(105)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel)
.addComponent(lblNewLabel_1))
.addGap(18)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE)
.addComponent(userIDText, GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE)))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(207)
.addComponent(login)
.addGap(117)
.addComponent(refresh)))
.addGap(131))
.addGroup(Alignment.LEADING, gl_contentPane.createSequentialGroup()
.addContainerGap()
.addComponent(label)
.addContainerGap(647, Short.MAX_VALUE))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(49)
.addComponent(lblBookmanagersystem)
.addGap(32)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(userIDText, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE))
.addGap(29)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_1)
.addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE))
.addGap(32)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(refresh)
.addComponent(login))
.addPreferredGap(ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
.addComponent(label))
);
contentPane.setLayout(gl_contentPane);

this.setLocationRelativeTo(null);//设置页面居中显示
//this.userNameText.setSize(10);
}

/**  
* @Title: openURL  
* @Description: TODO 启用系统默认浏览器来打开网址
* @param     参数  
* @return void    返回类型  
* @throws  
*/  
private void openURL() {
// TODO 自动生成的方法存根
//启用系统默认浏览器来打开网址。
        try {
            URI uri = new URI("https://www.baidu.com/");
            Desktop.getDesktop().browse(uri);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

}

/**  
* @Title: LoginActionPerformed  
* @Description: TODO(实现登录事件)  
* @param @param event    参数  
* @return void    返回类型  
* @throws  
*/  
private User LoginActionPerformed(ActionEvent event) {
// TODO 实现登录事件
String userID = this.userIDText.getText();
String password = new String(this.passwordField.getPassword());
String isAdmin = null;//判断是否是管理员
User user=new User();
/*7
* 验证用户输入的字符串是否为空
* 判断是否为空的方法 统一封装在stringutil中
*/

if (StringUtil.isEmpty(userID)) {
JOptionPane.showMessageDialog(null, "用户ID不能为空!!");
return user;

if (StringUtil.isEmpty(password)) {
JOptionPane.showMessageDialog(null, "密码不能为空");
return user;
}

/*
* 用户登录验证

*/
user=new User(Integer.parseInt(userID),password);
Connection connection=null;
try {
connection = dbUtil.getConnection();
User currentUser=userDao.login(connection, user);//如果查到数据之后,就可以返回包含数据的用户对象
if (currentUser !=null) {
//说明用户名,密码正确,登录成功,切换页面
//JOptionPane.showMessageDialog(null, "登录成功!");//测试验证用
dispose(); //如果登录成功,则销毁当前登录页面,使主页面可见即可

/**
* 获取是否是管理员
*/
if (currentUser.getIsAdmin().equals("1")) {
//说明是管理员
new MainFrm().setVisible(true);//设置主页可见
} else {
//说明不是管理员
new UserMainFrm(user).setVisible(true);//设置主页可见
}

}else {
JOptionPane.showMessageDialog(null, "用户名或密码错误!");
this.userIDText.setText("");//获取输入框的值,并设置为空,相当于重置
this.passwordField.setText("");
}
return user;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return user;
}finally {
try {
dbUtil.closeConn((com.mysql.jdbc.Connection) connection);
} catch (Exception e2) {
// TODO: handle exception
e2.printStackTrace();
}

}
}

/**  
* @Title: refreshActionPerformed  
* @Description: TODO(这里用一句话描述这个方法的作用)  
* @param @param event    参数  
* @return void    返回类型  
* @throws  
*/  
private void refreshActionPerformed(ActionEvent event) {
// TODO 重置按钮的事件,实现输入框重置
this.userIDText.setText("");//获取输入框的值,并设置为空
this.passwordField.setText("");
}
}



实例下载地址

BMS-图书管理系统源码(含数据库脚本)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警