diff --git a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml index 905f93f..6ba1d51 100644 --- a/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml +++ b/Supermarket/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml @@ -1,44 +1,7 @@ - - lower/lower - InnoDB - InnoDB - |root||root|localhost|ALTER|G -|root||root|localhost|ALTER ROUTINE|G -|root||root|localhost|CREATE|G -|root||root|localhost|CREATE ROUTINE|G -|root||root|localhost|CREATE TABLESPACE|G -|root||root|localhost|CREATE TEMPORARY TABLES|G -|root||root|localhost|CREATE USER|G -|root||root|localhost|CREATE VIEW|G -|root||root|localhost|DELETE|G -|root||root|localhost|DROP|G -|root||root|localhost|EVENT|G -|root||root|localhost|EXECUTE|G -|root||root|localhost|FILE|G -|root||root|localhost|INDEX|G -|root||root|localhost|INSERT|G -|root||root|localhost|LOCK TABLES|G -|root||root|localhost|PROCESS|G -|root||root|localhost|REFERENCES|G -|root||root|localhost|RELOAD|G -|root||root|localhost|REPLICATION CLIENT|G -|root||root|localhost|REPLICATION SLAVE|G -|root||root|localhost|SELECT|G -|root||root|localhost|SHOW DATABASES|G -|root||root|localhost|SHOW VIEW|G -|root||root|localhost|SHUTDOWN|G -|root||mysql.session|localhost|SUPER|G -|root||root|localhost|SUPER|G -|root||root|localhost|TRIGGER|G -|root||root|localhost|UPDATE|G -|root||root|localhost|grant option|G -performance_schema|schema||mysql.session|localhost|SELECT|G -sys|schema||mysql.sys|localhost|TRIGGER|G - 5.7.44 - + big5 1 diff --git a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml index 905f93f..6ba1d51 100644 --- a/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml +++ b/Supermarket/bin/.idea/dataSources/5b23e521-053a-47c0-ae28-a98b513bc6ec.xml @@ -1,44 +1,7 @@ - - lower/lower - InnoDB - InnoDB - |root||root|localhost|ALTER|G -|root||root|localhost|ALTER ROUTINE|G -|root||root|localhost|CREATE|G -|root||root|localhost|CREATE ROUTINE|G -|root||root|localhost|CREATE TABLESPACE|G -|root||root|localhost|CREATE TEMPORARY TABLES|G -|root||root|localhost|CREATE USER|G -|root||root|localhost|CREATE VIEW|G -|root||root|localhost|DELETE|G -|root||root|localhost|DROP|G -|root||root|localhost|EVENT|G -|root||root|localhost|EXECUTE|G -|root||root|localhost|FILE|G -|root||root|localhost|INDEX|G -|root||root|localhost|INSERT|G -|root||root|localhost|LOCK TABLES|G -|root||root|localhost|PROCESS|G -|root||root|localhost|REFERENCES|G -|root||root|localhost|RELOAD|G -|root||root|localhost|REPLICATION CLIENT|G -|root||root|localhost|REPLICATION SLAVE|G -|root||root|localhost|SELECT|G -|root||root|localhost|SHOW DATABASES|G -|root||root|localhost|SHOW VIEW|G -|root||root|localhost|SHUTDOWN|G -|root||mysql.session|localhost|SUPER|G -|root||root|localhost|SUPER|G -|root||root|localhost|TRIGGER|G -|root||root|localhost|UPDATE|G -|root||root|localhost|grant option|G -performance_schema|schema||mysql.session|localhost|SELECT|G -sys|schema||mysql.sys|localhost|TRIGGER|G - 5.7.44 - + big5 1 diff --git a/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class b/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class index 48fb917..a42e4a1 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class and b/Supermarket/bin/com/lingnan/supermarket/componet/BGPanel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class index 9f357e5..0fd2a16 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/BufferImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class index eb58e55..edc9cfc 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/SupplierInfImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class index 600997b..90181f1 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/UserServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class index 6eb7a4a..faf169f 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inOrderServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class index 92a062b..c7bf777 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/inRecordServiceImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class index fdb1611..dfab04b 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/prodCatalogImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class b/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class index ff1bba4..90154e9 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class and b/Supermarket/bin/com/lingnan/supermarket/dao/impl/productionImpl.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class index f97e071..1a2b49c 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class index 1852673..84beb05 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeStatusDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class index c835e1e..edc1b10 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/ChangeSumDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class index f75dc33..ab82379 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/CloseDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class index 47fd4db..fb0be84 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/InDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class index 519f6ff..48e52f6 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/OutDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class index ea8ac5e..eb9ddd9 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/ProductionDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class index bb919d1..d2ff2fe 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/SupplierInfDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class index 545b75e..17d8f88 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class index cee959a..1c4ec24 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class index f3a2c27..47acaf6 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class index b3b2d9f..f8fd576 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class and b/Supermarket/bin/com/lingnan/supermarket/dialog/UserInfDialog.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/dto/User.class b/Supermarket/bin/com/lingnan/supermarket/dto/User.class index 472ba94..c18a70e 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/dto/User.class and b/Supermarket/bin/com/lingnan/supermarket/dto/User.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class b/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class index 4e0822f..c9bf084 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/InOrderTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class index c95657a..e5bda6a 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/InRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class index 1d34276..d4ef217 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class and b/Supermarket/bin/com/lingnan/supermarket/table/InTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class b/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class index 807961f..cb4ca6e 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/OutOrderTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class index e674d5f..8c8a214 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/OutRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class index 6190e1b..369e79a 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class and b/Supermarket/bin/com/lingnan/supermarket/table/OutTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class b/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class index becc853..033463d 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/ProdCatalogTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class b/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class index 0a91b4d..e59a645 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class and b/Supermarket/bin/com/lingnan/supermarket/table/StorageRecordTM.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class index 74d0fce..e0b4d57 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class and b/Supermarket/bin/com/lingnan/supermarket/table/StorageTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class index bf99e47..dddd3b2 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class and b/Supermarket/bin/com/lingnan/supermarket/table/SupplierTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class b/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class index 9de7223..ac589ef 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class and b/Supermarket/bin/com/lingnan/supermarket/table/UserTableModel.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class b/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class index ce8f346..1c9a168 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class and b/Supermarket/bin/com/lingnan/supermarket/utils/CreateOrder.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class b/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class index 314feda..8c89bca 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class and b/Supermarket/bin/com/lingnan/supermarket/utils/FontUtil.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class index 85f0006..8eb35e4 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class and b/Supermarket/bin/com/lingnan/supermarket/utils/tplbTest.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class b/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class index cf447ff..b24e113 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class and b/Supermarket/bin/com/lingnan/supermarket/view/Demo4.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class b/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class index 48591f1..4bdddef 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class and b/Supermarket/bin/com/lingnan/supermarket/view/HomeView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class b/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class index d229f62..998ea75 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class and b/Supermarket/bin/com/lingnan/supermarket/view/InView$MyItemListener.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/InView.class b/Supermarket/bin/com/lingnan/supermarket/view/InView.class index b79f969..c6d8d22 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/InView.class and b/Supermarket/bin/com/lingnan/supermarket/view/InView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class b/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class index 0363364..0265a99 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class and b/Supermarket/bin/com/lingnan/supermarket/view/LoginView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class index 9184f41..c9026fb 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/MainView.class and b/Supermarket/bin/com/lingnan/supermarket/view/MainView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/OutView.class b/Supermarket/bin/com/lingnan/supermarket/view/OutView.class index 6e07973..c4c0a8f 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/OutView.class and b/Supermarket/bin/com/lingnan/supermarket/view/OutView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class index ad04087..006a906 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class and b/Supermarket/bin/com/lingnan/supermarket/view/ProdCatalogView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class b/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class index 33c5f3e..fdfbfcc 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class and b/Supermarket/bin/com/lingnan/supermarket/view/StorageView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class b/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class index 5e35ec5..2f20ef0 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class and b/Supermarket/bin/com/lingnan/supermarket/view/SupplierView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/UserView.class b/Supermarket/bin/com/lingnan/supermarket/view/UserView.class index 2de250a..7aac3e5 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/UserView.class and b/Supermarket/bin/com/lingnan/supermarket/view/UserView.class differ diff --git a/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class b/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class index 58f926a..0f912c1 100644 Binary files a/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class and b/Supermarket/bin/com/lingnan/supermarket/view/base/BaseView.class differ diff --git a/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java b/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java index 4b9bc0f..a953dc7 100644 --- a/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java +++ b/Supermarket/src/com/lingnan/supermarket/componet/BGPanel.java @@ -1,36 +1,46 @@ package com.lingnan.supermarket.componet; - import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; - import javax.swing.JPanel; public class BGPanel extends JPanel{ - - private Image image; + public BGPanel(Image image) { + // 定义一个构造方法,接收一个Image类型的参数image,用于创建BGPanel对象时传入要显示的图像 this.image = image; - + // 将传入的参数image赋值给类的成员变量image + int width = Toolkit.getDefaultToolkit().getScreenSize().width; + // 通过默认工具包(Toolkit)获取屏幕的宽度,存储在局部变量width中 int height = Toolkit.getDefaultToolkit().getScreenSize().height; + // 通过默认工具包(Toolkit)获取屏幕的高度,存储在局部变量height中 this.setSize(width, height); + // 设置该面板(BGPanel)的大小为整个屏幕的大小,即宽度和高度分别为获取到的屏幕宽高 } - - public BGPanel(Image image,int width,int height) { + + public BGPanel(Image image, int width, int height) { + // 定义另一个构造方法,接收一个Image类型的参数image以及表示宽度和高度的两个int类型参数,用于更灵活地创建BGPanel对象并指定其大小 this.image = image; - - + // 将传入的参数image赋值给类的成员变量image + this.setSize(width, height); + // 设置该面板(BGPanel)的大小为传入的指定宽度width和指定高度height } - - + + @Override protected void paintComponent(Graphics g) { + // 重写JPanel类中的paintComponent方法,用于绘制面板上的图像 super.paintComponent(g); - g.drawImage(image,0,0,getWidth(),getHeight(),this); - - } + // 调用父类(JPanel)的paintComponent方法,以确保完成一些默认的绘制操作,比如背景清除等 -} + g.drawImage(image, 0, 0, getWidth(), getHeight(), this); + // 使用传入的Graphics对象g在面板上绘制图像,参数含义如下: + // image:要绘制的图像对象,就是之前保存的成员变量image + // 0, 0:表示在面板上绘制图像的起始坐标(x坐标和y坐标),这里从面板的左上角(0, 0)位置开始绘制 + // getWidth(), getHeight():获取当前面板的宽度和高度,用于指定绘制图像时按照面板的实际大小进行拉伸或缩放,确保图像填满整个面板 + // this:表示图像观察者,用于接收图像绘制过程中的相关通知等 + } +} \ No newline at end of file diff --git a/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java index 7fa02c7..a4a7721 100644 --- a/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java +++ b/Supermarket/src/com/lingnan/supermarket/dialog/UserInfDialog.java @@ -1,4 +1,3 @@ - package com.lingnan.supermarket.dialog; import java.awt.Container; @@ -26,54 +25,74 @@ import com.lingnan.supermarket.view.LoginView; // UserInfDialog类继承自JDialog,用于创建一个修改用户信息的对话框窗口,并实现了ActionListener接口来处理按钮点击事件 public class UserInfDialog extends JDialog implements ActionListener { - // 以下是用于构建对话框界面的各个面板、标签、文本框和按钮等组件的声明 + // 构建对话框界面的各个面板、标签、文本框和按钮等组件的声明 private JPanel namePanel, loginNamePanel, phonePanel, opePanel, passwordPanel, sSuperPanel; + // 用于存放姓名相关组件的面板 private JLabel nameLabel, loginNameLabel, phoneLabel, passwordLabel, sSuperLabel; + // 分别对应姓名、登录名、联系电话、密码、权限等信息的标签组件,用于在界面上显示相应的文字提示 private JTextField nameTF, loginNameTF, phoneTF, passwordTF, sSuperTF; + // 分别对应姓名、登录名、联系电话、密码、权限等信息的文本框组件,用于用户输入或显示相应信息 private JButton saveBtn, cancelBtn; + // 保存按钮和取消按钮,用于触发保存修改信息或取消操作的动作 // 用户服务接口的实现类实例,用于调用与用户相关的数据库操作方法 private UserService userService = new UserServiceImpl(); + // 创建UserServiceImpl类的实例,通过该实例可以调用具体实现的用户相关数据库操作,比如更新用户信息等 // 要修改信息的用户对象 private User user; + // 存储当前要在对话框中进行信息修改操作的用户对象,包含了该用户原本的各种信息 // 用于存储用户权限级别,初始值为从传入的用户对象中获取的权限级别 private int sSuper = -1; + // 记录用户的权限级别,初始化为 -1,后续会根据传入用户对象的权限情况进行赋值 - // 下拉框组件,用于选择用户权限(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) + // 下拉框组件,用于选择用户权限 private JComboBox combo; + // 定义一个下拉框组件,用于展示可选的用户权限选项,其选项内容为字符串类型 + // 下拉框中的选项内容,包括当前权限以及不同的权限角色 - private String[] identity = { "当前权限", "收银员", "管理员", "超级管理员" }; + private String[] identity = { "当前权限", "收银员", "管理员", "超级管理员","进货员" }; + // 定义一个字符串数组,存储下拉框中可供选择的用户权限选项内容 // 父窗口JFrame的引用,可能用于在某些操作后对父窗口进行处理 private JFrame JFrame; + // 保存传入的父窗口(JFrame类型)的引用 // 构造函数,用于创建修改用户信息的对话框,传入父窗口JFrame和要修改信息的用户对象 public UserInfDialog(JFrame parent, User user) { - // 调用父类JDialog的构造函数,设置对话框的标题为"添加"(这里标题可能需要根据实际情况修改为更合适的,比如"修改用户信息") + // 调用父类JDialog的构造函数,设置对话框的标题为"添加" super(parent, "添加"); this.user = user; + // 将传入的要修改信息的用户对象赋值给当前类的成员变量user + // 设置当前用户的权限级别 this.sSuper = user.getUsuper(); + // 从传入的用户对象中获取其原本的权限级别,并赋值给当前类的成员变量sSuper // 设置对话框的大小 setSize(350, 300); + // 设置对话框的宽度为350像素,高度为300像素,确定对话框在屏幕上显示的初始大小 // 设置对话框在屏幕中央显示 setLocationRelativeTo(null); + // 通过传入null参数,使对话框在屏幕的中心位置显示 // 设置对话框为模态对话框,即显示时会阻塞其他窗口的操作 setModal(true); + // 模态对话框会强制用户在关闭它之前只能与该对话框进行交互,不能操作其他窗口 // 设置对话框大小不可调整 setResizable(false); + // 禁止用户通过拖动边框等方式改变对话框的大小,保持固定的布局和显示效果 // 设置对话框的布局为流式布局 this.setLayout(new FlowLayout()); + // 使用流式布局来排列对话框内的组件,组件会按照添加的顺序从左到右、从上到下依次排列 // 保存父窗口的引用 this.JFrame = parent; + // 将传入的父窗口引用赋值给当前类的成员变量JFrame // 初始化对话框的视图组件 initView(); @@ -84,34 +103,53 @@ public class UserInfDialog extends JDialog implements ActionListener { // 姓名面板及相关组件的初始化,文本框中显示当前用户的姓名信息 namePanel = new JPanel(); + // 创建一个新的面板,用于存放姓名相关的标签和文本框组件 nameLabel = new JLabel("姓名"); + // 创建一个显示"姓名"文字的标签组件 nameTF = new JTextField(user.getRname(), 15); + // 创建一个文本框组件,初始内容设置为传入用户对象的真实姓名(通过user.getRname()获取),文本框宽度设置为可显示15个字符左右 namePanel.add(nameLabel); + // 将姓名标签添加到姓名面板中 namePanel.add(nameTF); + // 将姓名文本框添加到姓名面板中 // 账号面板及相关组件的初始化,文本框中显示当前用户的账号信息 loginNamePanel = new JPanel(); + // 创建一个新的面板,用于存放账号相关的标签和文本框组件 loginNameLabel = new JLabel("账号"); + // 创建一个显示"账号"文字的标签组件 loginNameTF = new JTextField(user.getUsername(), 15); + // 创建一个文本框组件,初始内容设置为传入用户对象的用户名(通过user.getUsername()获取),文本框宽度设置为可显示15个字符左右 loginNamePanel.add(loginNameLabel); + // 将账号标签添加到账号面板中 loginNamePanel.add(loginNameTF); + // 将账号文本框添加到账号面板中 // 手机面板及相关组件的初始化,文本框中显示当前用户的手机信息 phonePanel = new JPanel(); - phoneLabel = new JLabel("联系"); + // 创建一个新的面板,用于存放手机相关的标签和文本框组件 + phoneLabel = new JLabel("电话"); + // 创建一个显示"联系"文字的标签组件 phoneTF = new JTextField(user.getPhone(), 15); + // 创建一个文本框组件,初始内容设置为传入用户对象的手机号码(通过user.getPhone()获取),文本框宽度设置为可显示15个字符左右 phonePanel.add(phoneLabel); + // 将手机标签添加到手机面板中 phonePanel.add(phoneTF); + // 将手机文本框添加到手机面板中 // 密码面板及相关组件的初始化,文本框中显示当前用户的密码信息 passwordPanel = new JPanel(); + // 创建一个新的面板,用于存放密码相关的标签和文本框组件 passwordLabel = new JLabel("密码"); + // 创建一个显示"密码"文字的标签组件 passwordTF = new JTextField(user.getPassword(), 15); + // 创建一个文本框组件,初始内容设置为传入用户对象的密码(通过user.getPassword()获取),文本框宽度设置为可显示15个字符左右 passwordPanel.add(passwordLabel); + // 将密码标签添加到密码面板中 passwordPanel.add(passwordTF); + // 将密码文本框添加到密码面板中 + - // 权限面板及相关组件的初始化,这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了 - /* sSuperPanel = new JPanel(); sSuperLabel = new JLabel("权限"); // sSuperTF = new JTextField(15); @@ -119,26 +157,40 @@ public class UserInfDialog extends JDialog implements ActionListener { combo.addItemListener(new MyItemListener()); sSuperPanel.add(sSuperLabel); sSuperPanel.add(combo); - */ + + // 上述被注释掉的代码原本用于创建权限相关的面板、标签、下拉框组件,并为下拉框添加选项改变的监听器,用于实现完整的权限选择功能,但目前处于简化状态 // 操作按钮面板及相关组件的初始化 opePanel = new JPanel(); + // 创建一个新的面板,用于存放操作按钮(保存和取消按钮) saveBtn = new JButton("保存"); + // 创建一个显示"保存"文字的按钮组件,用于触发保存用户信息修改的操作 cancelBtn = new JButton("取消"); + // 创建一个显示"取消"文字的按钮组件,用于触发取消当前修改操作的动作 // 为保存按钮和取消按钮添加点击事件监听器 saveBtn.addActionListener(this); + // 将保存按钮的点击事件绑定到当前类(实现了ActionListener接口)的actionPerformed方法上,以便处理保存按钮被点击后的操作逻辑 cancelBtn.addActionListener(this); + // 将取消按钮的点击事件绑定到当前类(实现了ActionListener接口)的actionPerformed方法上,以便处理取消按钮被点击后的操作逻辑 opePanel.add(saveBtn); + // 将保存按钮添加到操作按钮面板中 opePanel.add(cancelBtn); + // 将取消按钮添加到操作按钮面板中 // 将各个面板添加到对话框的内容面板中 Container container = getContentPane(); + // 获取对话框的内容面板,用于添加其他组件面板 container.add(namePanel); + // 将姓名面板添加到对话框的内容面板中 container.add(loginNamePanel); + // 将账号面板添加到对话框的内容面板中 container.add(passwordPanel); + // 将密码面板添加到对话框的内容面板中 container.add(phonePanel); - /*container.add(sSuperPanel);*/ + container.add(sSuperPanel); + // 原本可能添加权限面板 container.add(opePanel); + // 将操作按钮面板添加到对话框的内容面板中 } // 处理按钮点击事件的方法,实现了ActionListener接口中的方法 @@ -151,60 +203,85 @@ public class UserInfDialog extends JDialog implements ActionListener { // 获取用户在文本框中修改后的姓名、账号、手机和密码信息 String name = nameTF.getText(); + // 获取姓名文本框中用户输入或修改后的姓名内容 String loginName = loginNameTF.getText(); + // 获取账号文本框中用户输入或修改后的账号内容 String phone = phoneTF.getText(); + // 获取手机文本框中用户输入或修改后的手机号码内容 String password = passwordTF.getText(); + // 获取密码文本框中用户输入或修改后的密码内容 - // TODO 参数校验部分,这里应该对获取到的用户输入信息进行合法性校验,比如非空、格式等校验,但目前未实现具体逻辑 + // 此处注释提示了后续应该添加对获取到的用户输入信息进行合法性校验的代码 // 创建一个新的User对象,用于存储要更新到数据库的用户信息,设置了部分从原用户对象获取的信息以及修改后的信息 User user1 = new User(); user1.setId(user.getId()); + // 设置新用户对象的id为原用户对象的id,确保更新的是正确的用户记录 user1.setRname(name); + // 设置新用户对象的真实姓名为获取到的修改后的姓名内容 user1.setUsername(loginName); + // 设置新用户对象的用户名(账号)为获取到的修改后的账号内容 user1.setPhone(phone); + // 设置新用户对象的手机号码为获取到的修改后的手机号码内容 user1.setPassword(password); + // 设置新用户对象的密码为获取到的修改后的密码内容 user1.setImg(user.getImg()); + // 设置新用户对象的图片相关信息(这里不太明确具体用途,可能是用户头像之类的图片信息)为原用户对象的对应信息 user1.setUsuper(sSuper); + // 设置新用户对象的权限级别为当前记录的权限级别(在构造函数或其他地方已确定) // 调用用户服务接口的根据用户id更新用户信息的方法,将更新后的用户信息保存到数据库中,并获取返回结果 int result = userService.updateByIdUser(user1); if (result == 1) { // 如果更新成功,关闭当前对话框 this.dispose(); + // 通过调用dispose方法关闭当前的对话框窗口,释放相关资源 + // 弹出提示框显示修改成功信息,并提示重新登录 JOptionPane.showMessageDialog(this, "修改成功,请重新登陆", "提示", JOptionPane.INFORMATION_MESSAGE); + // 使用JOptionPane弹出一个信息提示框,向用户显示修改成功的消息,并提示需要重新登录,提示框的图标为信息图标(INFORMATION_MESSAGE表示) + // 关闭父窗口 this.JFrame.dispose(); + // 通过调用父窗口的dispose方法关闭父窗口 + // 创建并显示新的登录视图 new LoginView(); + // 创建一个新的登录视图(LoginView类的实例)并显示出来,方便用户重新登录系统 } else { // 如果更新失败,弹出提示框显示修改失败信息 JOptionPane.showMessageDialog(this, "修改失败", "提示", JOptionPane.ERROR_MESSAGE); + // 使用JOptionPane弹出一个错误提示框,向用户显示修改失败的消息 } } else if (source == cancelBtn) { // 如果点击的是取消按钮,直接关闭当前对话框 this.dispose(); + // 通过调用dispose方法关闭当前对话框,放弃本次修改操作,释放相关资源 } } - // 内部类,实现了ItemListener接口,用于监听下拉框选项变化事件(这里部分代码被注释掉,可能原本有完整的权限选择功能,后简化了) + // 实现了ItemListener接口,用于监听下拉框选项变化事件 public class MyItemListener implements ItemListener { @Override public void itemStateChanged(ItemEvent e) { // 获取触发事件的下拉框组件 JComboBox cb = (JComboBox) e.getSource(); + // 从事件源中获取触发选项改变事件的下拉框对象 + // 获取当前选中的下拉框选项内容 String sSuper1 = (String) cb.getSelectedItem(); + // 获取下拉框当前选中的选项对应的字符串内容 + if (sSuper1.equals("当前权限")) sSuper = user.getUsuper(); else if (sSuper1.equals("收银员")) sSuper = 2; - else if (sSuper1.equals("管理员")): - sSuper = 1; - else - sSuper = 0; + else if (sSuper1.equals("管理员")) + sSuper = 1; + else + sSuper = 0; + // 根据下拉框选中的不同选项内容,来设置当前用户的权限级别,不同的数字0、1、2对应不同的权限 } } } \ No newline at end of file