首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

database_design.zip

行业研究 76.71KB 23 需要积分: 1
立即下载

资源介绍:

database_design.zip
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; public class Borrowing_records extends JFrame { private JTextField txtBorrowingID; private JTextField txtBorrowingTime; private JTextField txtReturnTime; private JTextField txtWhetherToReturn; private JTextField txtReaderID; private JTextField txtISBN; private JButton btnSearch; private JButton btnUpdate; private JButton btnViewAll; private JButton btnAddNew; public Borrowing_records() { borrowing_recordsGUI(); borrowing_records_setupEvents(); } private void borrowing_recordsGUI() { setTitle("Borrowing Management System"); setSize(600, 300); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(8, 2, 10, 10)); JLabel lblBorrowingID = new JLabel("Borrowing ID:"); txtBorrowingID = new JTextField(20); JLabel lblBorrowingTime = new JLabel("Borrowing Time:"); txtBorrowingTime = new JTextField(20); JLabel lblReturnTime = new JLabel("Return Time:"); txtReturnTime = new JTextField(20); JLabel lblWhetherToReturn = new JLabel("Whether To Return:"); txtWhetherToReturn = new JTextField(20); JLabel lblReaderID = new JLabel("Reader ID:"); txtReaderID = new JTextField(20); JLabel lblISBN = new JLabel("ISBN ID:"); txtISBN = new JTextField(20); btnSearch = new JButton("Search"); btnUpdate = new JButton("Update"); btnViewAll = new JButton("View All"); btnAddNew = new JButton("Add New"); panel.add(lblBorrowingID); panel.add(txtBorrowingID); panel.add(lblBorrowingTime); panel.add(txtBorrowingTime); panel.add(lblReturnTime); panel.add(txtReturnTime); panel.add(lblWhetherToReturn); panel.add(txtWhetherToReturn); panel.add(lblReaderID); panel.add(txtReaderID); panel.add(lblISBN); panel.add(txtISBN); panel.add(btnSearch); panel.add(btnUpdate); panel.add(btnViewAll); panel.add(btnAddNew); add(panel); setVisible(true); } private void borrowing_records_setupEvents() { btnSearch.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchBorrowing(); } }); btnUpdate.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateBorrowing(); } }); btnViewAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { viewAllBorrowings(); } }); btnAddNew.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addNewBorrowing(); } }); } private void searchBorrowing() { String borrowingID = txtBorrowingID.getText().trim(); if (borrowingID.isEmpty()) { JOptionPane.showMessageDialog(this, "Please enter Borrowing ID to search."); return; } try (Connection conn = DBConnection.getConnection(); PreparedStatement stmt = conn.prepareStatement("SELECT * FROM borrowing_records WHERE borrowing_ID = ?")) { stmt.setString(1, borrowingID); ResultSet rs = stmt.executeQuery(); if (rs.next()) { txtBorrowingTime.setText(rs.getString("borrowing_time")); txtReturnTime.setText(rs.getString("return_time")); txtWhetherToReturn.setText(rs.getString("whether_to_return")); txtReaderID.setText(rs.getString("reader_ID")); txtISBN.setText(rs.getString("ISBN_ID")); } else { JOptionPane.showMessageDialog(this, "Borrowing not found."); } } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this, "Database error: " + ex.getMessage()); } } private void updateBorrowing() { String borrowingID = txtBorrowingID.getText().trim(); if (borrowingID.isEmpty()) { JOptionPane.showMessageDialog(this, "Please enter Borrowing ID to update."); return; } String borrowingTime = txtBorrowingTime.getText().trim(); String returnTime = txtReturnTime.getText().trim(); String whetherToReturn = txtWhetherToReturn.getText().trim(); String readerID = txtReaderID.getText().trim(); String ISBN = txtISBN.getText().trim(); try (Connection conn = DBConnection.getConnection(); PreparedStatement stmt = conn.prepareStatement("UPDATE borrowing_records SET borrowing_time = ?, return_time = ?, whether_to_return = ?, reader_ID = ?, ISBN_ID = ? WHERE borrowing_ID = ?")) { stmt.setString(1, borrowingTime); stmt.setString(2, returnTime); stmt.setString(3, whetherToReturn); stmt.setString(4, readerID); stmt.setString(5, ISBN); stmt.setString(6, borrowingID); int rowsUpdated = stmt.executeUpdate(); if (rowsUpdated > 0) { JOptionPane.showMessageDialog(this, "Borrowing updated successfully."); } else { JOptionPane.showMessageDialog(this, "Failed to update borrowing."); } } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this, "Database error: " + ex.getMessage()); } } private void viewAllBorrowings() { try (Connection conn = DBConnection.getConnection(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM borrowing_records")) { JFrame frame = new JFrame("All Borrowings"); DefaultTableModel model = new DefaultTableModel(new Object[]{"ID", "Borrowing Time", "Return Time", "Whether To Return", "Reader ID", "ISBN ID"}, 0); JTable table = new JTable(model); while (rs.next()) { Object[] row = {rs.getString("borrowing_ID"), rs.getString("borrowing_time"), rs.getString("return_time"), rs.getString("whether_to_return"), rs.getString("reader_ID"), rs.getString("ISBN_ID")}; model.addRow(row); } frame.add(new JScrollPane(table)); frame.setSize(600, 400); frame.setVisible(true); } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(this, "Database error: " + ex.getMessage()); } } private void addNewBorrowing() { String borrowingID = txtBorrowingID.getText().trim(); String borrowingTime = txtBorrowingTime.getText().trim(); String returnTime = txtReturnTime.getText().trim(); String whetherToReturn = txtWhetherToReturn.getText().trim(); String readerID = txtReaderID.getText().trim(); String ISBN = txtISBN.getText().trim(); if (borrowingID.isEmpty() || borrowingTime.isEmpty() || returnTime.isEmpty() || whetherToReturn.isEmpty() || readerID.isEmpty() || ISBN.isEmpty()) { JOptionPane.showMessageDialog(this, "All fields are required to add a

资源文件列表:

database_design.zip 大约有69个文件
  1. database_design/.gitignore 344B
  2. database_design/.idea/
  3. database_design/.idea/.gitignore 50B
  4. database_design/.idea/dbnavigator.xml 20.79KB
  5. database_design/.idea/misc.xml 276B
  6. database_design/.idea/modules.xml 277B
  7. database_design/.idea/uiDesigner.xml 8.71KB
  8. database_design/.idea/workspace.xml 2.83KB
  9. database_design/database_design.iml 749B
  10. database_design/out/
  11. database_design/out/production/
  12. database_design/out/production/database_design/
  13. database_design/out/production/database_design/Book$1.class 670B
  14. database_design/out/production/database_design/Book$2.class 670B
  15. database_design/out/production/database_design/Book$3.class 671B
  16. database_design/out/production/database_design/Book$4.class 670B
  17. database_design/out/production/database_design/Book.class 8.08KB
  18. database_design/out/production/database_design/Borrowing_records$1.class 767B
  19. database_design/out/production/database_design/Borrowing_records$2.class 767B
  20. database_design/out/production/database_design/Borrowing_records$3.class 769B
  21. database_design/out/production/database_design/Borrowing_records$4.class 767B
  22. database_design/out/production/database_design/Borrowing_records.class 8.5KB
  23. database_design/out/production/database_design/Consumer$1.class 702B
  24. database_design/out/production/database_design/Consumer$2.class 702B
  25. database_design/out/production/database_design/Consumer$3.class 704B
  26. database_design/out/production/database_design/Consumer$4.class 702B
  27. database_design/out/production/database_design/Consumer.class 7.73KB
  28. database_design/out/production/database_design/dataDesignMain$1.class 602B
  29. database_design/out/production/database_design/dataDesignMain.class 563B
  30. database_design/out/production/database_design/DBConnection.class 714B
  31. database_design/out/production/database_design/librarian$1.class 710B
  32. database_design/out/production/database_design/librarian$2.class 710B
  33. database_design/out/production/database_design/librarian$3.class 712B
  34. database_design/out/production/database_design/librarian$4.class 710B
  35. database_design/out/production/database_design/librarian.class 7.77KB
  36. database_design/out/production/database_design/MainFrame$1.class 717B
  37. database_design/out/production/database_design/MainFrame$2.class 725B
  38. database_design/out/production/database_design/MainFrame$3.class 743B
  39. database_design/out/production/database_design/MainFrame$4.class 727B
  40. database_design/out/production/database_design/MainFrame$5.class 721B
  41. database_design/out/production/database_design/MainFrame$6.class 741B
  42. database_design/out/production/database_design/MainFrame$7.class 735B
  43. database_design/out/production/database_design/MainFrame.class 1.66KB
  44. database_design/out/production/database_design/reader$1.class 686B
  45. database_design/out/production/database_design/reader$2.class 686B
  46. database_design/out/production/database_design/reader$3.class 688B
  47. database_design/out/production/database_design/reader$4.class 686B
  48. database_design/out/production/database_design/reader.class 7.62KB
  49. database_design/out/production/database_design/reader_borrowing$1.class 754B
  50. database_design/out/production/database_design/reader_borrowing$2.class 754B
  51. database_design/out/production/database_design/reader_borrowing$3.class 756B
  52. database_design/out/production/database_design/reader_borrowing$4.class 754B
  53. database_design/out/production/database_design/reader_borrowing.class 8.24KB
  54. database_design/out/production/database_design/reader_return$1.class 733B
  55. database_design/out/production/database_design/reader_return$2.class 733B
  56. database_design/out/production/database_design/reader_return$3.class 735B
  57. database_design/out/production/database_design/reader_return$4.class 733B
  58. database_design/out/production/database_design/reader_return.class 8.26KB
  59. database_design/src/
  60. database_design/src/Book.java 7.95KB
  61. database_design/src/Borrowing_records.java 8.86KB
  62. database_design/src/Consumer.java 7.75KB
  63. database_design/src/dataDesignMain.java 350B
  64. database_design/src/DBConnection.java 411B
  65. database_design/src/librarian.java 7.97KB
  66. database_design/src/MainFrame.java 2.91KB
  67. database_design/src/reader.java 7.54KB
  68. database_design/src/reader_borrowing.java 8.43KB
  69. database_design/src/reader_return.java 8.44KB
0评论
提交 加载更多评论
其他资源 西北工业大学python实验考试资料
本人py实验考试满分,一点点整理好的资料,免费(应该是)分享给大家捏。 包含模拟考试题目,日常oj题目,Noj题目,均附带AC答案。 有关于实验考试详细的问题可以咨询我(小偿,注明来意),v:AsakawaNagi0614
JavaWeb课程设计-药品管理系统/药物管理系统源码
基于Maven的药品管理系统/药物管理系统源码 使用ElementUI插件 实现的功能主要有: 药品信息的增删改查 员工信息的增删改查 敏感词汇的过滤 拦截器、文件上传等功能 还使用ECharts展示药品销量等数据 大概是这样
sm2算法sm2算法sm2算法sm2算法
sm2算法sm2算法sm2算法sm2算法
中科大EPC英语考试听力音频与答案
中科大EPC英语考试听力音频与答案
中科大EPC英语考试听力音频与答案 中科大EPC英语考试听力音频与答案
content_1721826951264.zip
content_1721826951264.zip
c语言扫雷项目制作压缩包
c语言扫雷项目制作压缩包
椭圆曲线加密算法(Elliptic Curve Cryptography, ECC)来生成一个密钥对,并进一步计算系统公钥
上述代码的作用是使用椭圆曲线加密算法(Elliptic Curve Cryptography, ECC)来生成一个密钥对,并进一步计算系统公钥。具体来说,它包括以下步骤: 定义哈希函数:代码定义了四个不同的哈希函数(H1、H2、H3、H4),这些函数使用SHA-256哈希算法,并对结果进行模运算以确保结果在特定范围内。 选择椭圆曲线:使用SECP256k1椭圆曲线,这是一个常用的曲线,特别是在比特币等加密货币中使用。 生成密钥对:使用ECDSA(Elliptic Curve Digital Signature Algorithm)生成一个私钥(kg_priv)和对应的公钥(kg_pub)。 获取椭圆曲线参数:获取椭圆曲线的阶数p。 随机选择主私钥η:在椭圆曲线的阶数范围内随机选择一个整数作为主私钥η。 计算系统公钥Ppub:计算系统公钥Ppub,其值为η乘以公钥点P。
俄罗斯方块的python代码
这段Python代码实现了一个简单的俄罗斯方块游戏,使用Pygame库处理图形和用户输入。游戏初始化Pygame库并设置屏幕大小为800x600像素,定义不同颜色和形状的方块。游戏由一个`Tetris`类管理,负责游戏状态和逻辑操作,每个方块由一个`Block`类表示,包含其形状、颜色、位置等信息。 在主循环中,游戏通过事件处理机制响应用户的键盘输入,箭头键用于移动和旋转方块,空格键用于快速下落。游戏会检测方块是否与已有的方块或边界发生碰撞,如发生碰撞,当前方块会固定在场地上并生成新方块。填满的行会被清除,玩家获得相应分数。 游戏通过一个二维数组维护场地状态,每个元素表示一个单元格是否被占据,通过检查和清除单元格实现行消除。整个游戏不断刷新屏幕更新显示,确保流畅运行,绘制背景、方块和边框,使界面美观易理解。 总体而言,这段代码展示了如何使用Pygame库实现经典俄罗斯方块游戏,包括图形绘制、用户输入处理和基本游戏逻辑,让玩家通过移动和旋转方块消除行并获得高分。