├── .classpath ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── README.md ├── bin └── .gitignore ├── img ├── Main.jpg ├── account.jpg ├── admintop.jpg ├── ah.jpg ├── bookadmin.jpg ├── booksearch.jpg ├── kiss.gif ├── kiss1.gif ├── land1.jpg ├── register.jpg ├── returning.jpg ├── tabletop.jpg └── top.jpg ├── lib └── mysql-connector-java-8.0.16.jar ├── mis.sql └── src ├── database ├── Adduser.java ├── Book.java ├── BorrowRecords.java ├── Category.java ├── ConnectDatabase.java ├── FindBook.java ├── FindBorrow.java ├── Landing.java ├── ModifyPassword.java └── UpdateAdmin.java └── view ├── AccountManagement.java ├── AddBook.java ├── AddCategory.java ├── Admin.java ├── AdminAccount.java ├── AdminBorrow.java ├── AdminSetPass.java ├── BookAdmin.java ├── BookSearch.java ├── BorrowRecords.java ├── BorrowingReturning.java ├── DeleteBook.java ├── Land.java ├── Main.java ├── MainInterface.java ├── ModifyBook.java ├── ModifyCategory.java ├── ModifyInformation.java ├── ModifyPassword.java ├── Permissions.java └── Register.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Library 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=10 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=10 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 13 | org.eclipse.jdt.core.compiler.release=enabled 14 | org.eclipse.jdt.core.compiler.source=10 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java_Library_Management_System 2 | 功能:系统分管理员界面与用户界面 3 | 4 | 管理员:实现对图书的增、删、改、查,对所有借阅历史的搜索及所有账户的信息,用户的权限与管理,设定密码,借阅图书及对自己账户的资料修改 5 | 6 | 用户:实现对图书的借阅功能、查看自己的借阅历史,在用户账户方面实现修改密码以及修改个人信息功能 7 | 8 | 另外:当数据库中用户表为空,则第一个注册的用户默认为管理员 9 | 10 | 具体页面链接:https://blog.csdn.net/kongsanjin/article/details/97611293 11 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | /database/ 2 | /view/ 3 | -------------------------------------------------------------------------------- /img/Main.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/Main.jpg -------------------------------------------------------------------------------- /img/account.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/account.jpg -------------------------------------------------------------------------------- /img/admintop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/admintop.jpg -------------------------------------------------------------------------------- /img/ah.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/ah.jpg -------------------------------------------------------------------------------- /img/bookadmin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/bookadmin.jpg -------------------------------------------------------------------------------- /img/booksearch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/booksearch.jpg -------------------------------------------------------------------------------- /img/kiss.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/kiss.gif -------------------------------------------------------------------------------- /img/kiss1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/kiss1.gif -------------------------------------------------------------------------------- /img/land1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/land1.jpg -------------------------------------------------------------------------------- /img/register.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/register.jpg -------------------------------------------------------------------------------- /img/returning.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/returning.jpg -------------------------------------------------------------------------------- /img/tabletop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/tabletop.jpg -------------------------------------------------------------------------------- /img/top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/img/top.jpg -------------------------------------------------------------------------------- /lib/mysql-connector-java-8.0.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/lib/mysql-connector-java-8.0.16.jar -------------------------------------------------------------------------------- /mis.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat Premium Data Transfer 3 | 4 | Source Server : kx 5 | Source Server Type : MySQL 6 | Source Server Version : 50703 7 | Source Host : localhost:3306 8 | Source Schema : mis 9 | 10 | Target Server Type : MySQL 11 | Target Server Version : 50703 12 | File Encoding : 65001 13 | 14 | Date: 25/09/2019 22:36:47 15 | */ 16 | 17 | SET NAMES utf8mb4; 18 | SET FOREIGN_KEY_CHECKS = 0; 19 | 20 | -- ---------------------------- 21 | -- Table structure for bookcategory 22 | -- ---------------------------- 23 | DROP TABLE IF EXISTS `bookcategory`; 24 | CREATE TABLE `bookcategory` ( 25 | `Category` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类别', 26 | PRIMARY KEY (`Category`) USING BTREE 27 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 28 | 29 | -- ---------------------------- 30 | -- Table structure for booktable 31 | -- ---------------------------- 32 | DROP TABLE IF EXISTS `booktable`; 33 | CREATE TABLE `booktable` ( 34 | `bookid` int(10) NOT NULL AUTO_INCREMENT COMMENT '书号', 35 | `category` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类别', 36 | `bookname` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '书名', 37 | `author` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '作者', 38 | `press` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出版社', 39 | `state` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态', 40 | PRIMARY KEY (`bookid`) USING BTREE, 41 | INDEX `category`(`category`) USING BTREE, 42 | CONSTRAINT `booktable_ibfk_1` FOREIGN KEY (`category`) REFERENCES `bookcategory` (`Category`) ON DELETE NO ACTION ON UPDATE CASCADE 43 | ) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 44 | 45 | -- ---------------------------- 46 | -- Table structure for borrowrecords 47 | -- ---------------------------- 48 | DROP TABLE IF EXISTS `borrowrecords`; 49 | CREATE TABLE `borrowrecords` ( 50 | `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '借书序列', 51 | `user` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', 52 | `bookid` int(10) NOT NULL COMMENT '书号', 53 | `bookname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '书名', 54 | `borrowtime` date NOT NULL COMMENT '借书时间', 55 | `returntime` date NULL DEFAULT NULL COMMENT '还书时间', 56 | `status` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '状态', 57 | PRIMARY KEY (`id`) USING BTREE 58 | ) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 59 | 60 | -- ---------------------------- 61 | -- Table structure for usertable 62 | -- ---------------------------- 63 | DROP TABLE IF EXISTS `usertable`; 64 | CREATE TABLE `usertable` ( 65 | `user` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名', 66 | `studentid` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '学号', 67 | `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '姓名', 68 | `password` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '密码', 69 | `admin` int(10) NOT NULL COMMENT '是否为管理员账户 1为管理员,0为普通用户,默认为0', 70 | PRIMARY KEY (`user`) USING BTREE 71 | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; 72 | 73 | SET FOREIGN_KEY_CHECKS = 1; 74 | -------------------------------------------------------------------------------- /src/database/Adduser.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/Adduser.java -------------------------------------------------------------------------------- /src/database/Book.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/Book.java -------------------------------------------------------------------------------- /src/database/BorrowRecords.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/BorrowRecords.java -------------------------------------------------------------------------------- /src/database/Category.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/Category.java -------------------------------------------------------------------------------- /src/database/ConnectDatabase.java: -------------------------------------------------------------------------------- 1 | package database; 2 | 3 | import java.sql.Connection; 4 | import java.sql.DriverManager; 5 | import java.sql.SQLException; 6 | 7 | public class ConnectDatabase { 8 | 9 | public static Connection connectDB() { 10 | 11 | String url = "jdbc:mysql://localhost:3306/mis?serverTimezone=GMT%2B8"; 12 | 13 | try { 14 | Class.forName("com.mysql.cj.jdbc.Driver"); 15 | } catch (Exception e) { 16 | } 17 | 18 | Connection con = null; 19 | 20 | try { 21 | con = DriverManager.getConnection(url, "root", "123456"); 22 | } catch (SQLException e) { 23 | } 24 | 25 | return con; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/database/FindBook.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/FindBook.java -------------------------------------------------------------------------------- /src/database/FindBorrow.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/FindBorrow.java -------------------------------------------------------------------------------- /src/database/Landing.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/Landing.java -------------------------------------------------------------------------------- /src/database/ModifyPassword.java: -------------------------------------------------------------------------------- 1 | package database; 2 | 3 | import java.sql.Connection; 4 | import java.sql.PreparedStatement; 5 | import java.sql.SQLException; 6 | 7 | public class ModifyPassword { 8 | public ModifyPassword() { 9 | } 10 | public static void modifypass(String user,String password) { 11 | Connection con = ConnectDatabase.connectDB(); 12 | 13 | PreparedStatement preSql; 14 | 15 | String sqlStr = "update usertable set password=? where user = ?"; 16 | 17 | try { 18 | preSql = con.prepareStatement(sqlStr); 19 | preSql.setString(1, password); 20 | preSql.setString(2, user); 21 | int ok = preSql.executeUpdate(); 22 | 23 | con.close(); 24 | } catch (SQLException e) { 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/database/UpdateAdmin.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/database/UpdateAdmin.java -------------------------------------------------------------------------------- /src/view/AccountManagement.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AccountManagement.java -------------------------------------------------------------------------------- /src/view/AddBook.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AddBook.java -------------------------------------------------------------------------------- /src/view/AddCategory.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AddCategory.java -------------------------------------------------------------------------------- /src/view/Admin.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/Admin.java -------------------------------------------------------------------------------- /src/view/AdminAccount.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AdminAccount.java -------------------------------------------------------------------------------- /src/view/AdminBorrow.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AdminBorrow.java -------------------------------------------------------------------------------- /src/view/AdminSetPass.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/AdminSetPass.java -------------------------------------------------------------------------------- /src/view/BookAdmin.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/BookAdmin.java -------------------------------------------------------------------------------- /src/view/BookSearch.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/BookSearch.java -------------------------------------------------------------------------------- /src/view/BorrowRecords.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/BorrowRecords.java -------------------------------------------------------------------------------- /src/view/BorrowingReturning.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/BorrowingReturning.java -------------------------------------------------------------------------------- /src/view/DeleteBook.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/DeleteBook.java -------------------------------------------------------------------------------- /src/view/Land.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/Land.java -------------------------------------------------------------------------------- /src/view/Main.java: -------------------------------------------------------------------------------- 1 | package view; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | new Land(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/view/MainInterface.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/MainInterface.java -------------------------------------------------------------------------------- /src/view/ModifyBook.java: -------------------------------------------------------------------------------- 1 | package view; 2 | 3 | import java.awt.Color; 4 | import java.awt.Font; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.ItemEvent; 8 | import java.awt.event.ItemListener; 9 | 10 | import javax.swing.Icon; 11 | import javax.swing.ImageIcon; 12 | import javax.swing.JButton; 13 | import javax.swing.JComboBox; 14 | import javax.swing.JFrame; 15 | import javax.swing.JLabel; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | import javax.swing.JTextField; 19 | import javax.swing.table.DefaultTableModel; 20 | 21 | import database.Book; 22 | import database.FindBook; 23 | 24 | public class ModifyBook extends JFrame{ 25 | // 面板 26 | private JPanel jPanel = new JPanel(); 27 | // 标签 28 | private JLabel jLabel = new JLabel("修改图书信息"); 29 | private JLabel jLabel2 = new JLabel("类 别:"); 30 | private JLabel jLabel3 = new JLabel("书 名:"); 31 | private JLabel jLabel4 = new JLabel("作 者:"); 32 | private JLabel jLabel5 = new JLabel("出版社:"); 33 | private JLabel jLabel6 = new JLabel("状 态:"); 34 | private JLabel jLabel7 = new JLabel("书 号:"); 35 | // 文本框 36 | private JTextField field = new JTextField(20); 37 | private JTextField field2 = new JTextField(20); 38 | private JTextField field3 = new JTextField(20); 39 | private JTextField field4 = new JTextField(20); 40 | // 下拉框 41 | private JComboBox box = new JComboBox(); 42 | private JComboBox box1 = new JComboBox(); 43 | // 按钮 44 | private JButton button = new JButton("确定"); 45 | // 字体 46 | private Font font = new Font("宋体", Font.BOLD, 40); 47 | private Font font2 = new Font("宋体", Font.BOLD, 25); 48 | private Font font3 = new Font("宋体", Font.BOLD, 20); 49 | 50 | // 表格 用于更新图书搜索界面的表格 51 | public DefaultTableModel model = new DefaultTableModel(); 52 | 53 | private String s; 54 | private String s1; 55 | 56 | public ModifyBook() { 57 | // 改变背景图片 58 | Icon i = new ImageIcon("img\\admintop.jpg"); 59 | JLabel Label = new JLabel(i); 60 | Label.setBounds(0, 0, 580, 100); 61 | setLayout(null); 62 | setSize(580, 650); 63 | setLocationRelativeTo(null); 64 | 65 | setTitle("修改图书信息"); 66 | 67 | jLabel.setFont(font); 68 | jLabel.setBounds(155, 80, 400, 100); 69 | 70 | jLabel7.setFont(font2); 71 | jLabel7.setBounds(125, 200, 250, 30); 72 | 73 | jLabel2.setFont(font2); 74 | jLabel2.setBounds(125, 250, 250, 30); 75 | 76 | jLabel3.setFont(font2); 77 | jLabel3.setBounds(125, 300, 250, 30); 78 | 79 | jLabel4.setFont(font2); 80 | jLabel4.setBounds(125, 350, 250, 30); 81 | 82 | jLabel5.setFont(font2); 83 | jLabel5.setBounds(125, 400, 250, 30); 84 | 85 | jLabel6.setFont(font2); 86 | jLabel6.setBounds(125, 450, 250, 30); 87 | // 下拉框 88 | box.addItem("请选择类别"); 89 | Book.findcategory(box); 90 | box.setFont(font3); 91 | box.setBounds(245, 250, 200, 30); 92 | // box.setBackground(Color.cyan); 93 | box.setOpaque(false); 94 | 95 | // 下拉框 96 | box1.addItem("在馆"); 97 | box1.addItem("外借"); 98 | //Book.findcategory(box); 99 | box1.setFont(font3); 100 | box1.setBounds(245, 450, 200, 30); 101 | // box.setBackground(Color.cyan); 102 | box1.setOpaque(false); 103 | 104 | // 文本框 105 | field4.setFont(font3); 106 | field4.setBackground(Color.cyan); 107 | field4.setBounds(245, 200, 200, 30); 108 | field4.setOpaque(false); 109 | 110 | field.setFont(font3); 111 | field.setBackground(Color.cyan); 112 | field.setBounds(245, 300, 200, 30); 113 | field.setOpaque(false); 114 | 115 | field2.setFont(font3); 116 | field2.setBackground(Color.cyan); 117 | field2.setBounds(245, 350, 200, 30); 118 | field2.setOpaque(false); 119 | 120 | field3.setFont(font3); 121 | field3.setBackground(Color.cyan); 122 | field3.setBounds(245, 400, 200, 30); 123 | field3.setOpaque(false); 124 | 125 | // 按钮 126 | button.setFont(font2); 127 | button.setBounds(120, 510, 325, 35); 128 | button.setBackground(Color.cyan); 129 | button.setOpaque(false); 130 | 131 | jPanel.add(jLabel); 132 | jPanel.add(jLabel2); 133 | jPanel.add(jLabel3); 134 | jPanel.add(jLabel4); 135 | jPanel.add(jLabel5); 136 | jPanel.add(jLabel6); 137 | jPanel.add(jLabel7); 138 | jPanel.add(box); 139 | jPanel.add(box1); 140 | jPanel.add(field); 141 | jPanel.add(field2); 142 | jPanel.add(field3); 143 | jPanel.add(field4); 144 | jPanel.add(button); 145 | 146 | add(); 147 | 148 | // jPanel.setBackground(Color.blue); 149 | jPanel.setBounds(0, 0, 850, 650); 150 | jPanel.setOpaque(false); 151 | jPanel.setLayout(null); 152 | // 不可以改变窗体的大小 153 | setResizable(false); 154 | add(jPanel); 155 | add(Label); 156 | setVisible(true); 157 | } 158 | 159 | public void setModel(DefaultTableModel model) { 160 | this.model = model; 161 | } 162 | 163 | private void add() { 164 | //获取下拉列表值 165 | s = "请选择类别"; 166 | box.addItemListener(new ItemListener() { 167 | 168 | @Override 169 | public void itemStateChanged(ItemEvent e) { 170 | // TODO Auto-generated method stub 171 | if(e.getStateChange()==ItemEvent.SELECTED) { 172 | s=(String)e.getItem(); 173 | } 174 | } 175 | }); 176 | 177 | //获取下拉列表值 178 | s1 = "在馆"; 179 | box1.addItemListener(new ItemListener() { 180 | 181 | @Override 182 | public void itemStateChanged(ItemEvent e) { 183 | // TODO Auto-generated method stub 184 | if(e.getStateChange()==ItemEvent.SELECTED) { 185 | s1=(String)e.getItem(); 186 | } 187 | } 188 | }); 189 | 190 | //添加搜索按钮事件 191 | button.addActionListener(new ActionListener() { 192 | 193 | @Override 194 | public void actionPerformed(ActionEvent e) { 195 | // TODO Auto-generated method stub 196 | try { 197 | String bookname = field.getText().trim(); 198 | String author = field2.getText().trim(); 199 | String press = field3.getText().trim(); 200 | int bookid = Integer.parseInt(field4.getText().trim()); 201 | Book.modifybook(bookid, s, bookname, author, press, s1); 202 | model.setRowCount(0); 203 | FindBook.allbook(model); 204 | JOptionPane.showMessageDialog(null, "操作成功"); 205 | }catch(Exception e1){ 206 | JOptionPane.showMessageDialog(null, "输入不正确", "警告", JOptionPane.WARNING_MESSAGE); 207 | } 208 | 209 | } 210 | }); 211 | 212 | } 213 | 214 | } 215 | -------------------------------------------------------------------------------- /src/view/ModifyCategory.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/ModifyCategory.java -------------------------------------------------------------------------------- /src/view/ModifyInformation.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/ModifyInformation.java -------------------------------------------------------------------------------- /src/view/ModifyPassword.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/ModifyPassword.java -------------------------------------------------------------------------------- /src/view/Permissions.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/Permissions.java -------------------------------------------------------------------------------- /src/view/Register.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kongxin-github/Java_Library_Management_System/70a6eb6b96fe64575d8051f1a59055bfc5dc5885/src/view/Register.java --------------------------------------------------------------------------------