|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.lingnan.supermarket.view; // 定义包名,所有视图相关的类都在这个包下
|
|
|
|
package com.lingnan.supermarket.view; // 定义包名,所有视图相关的类都在这个包下
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.event.ActionEvent; // 导入ActionEvent类,用于监听动作事件
|
|
|
|
import java.awt.event.ActionEvent; // 导入ActionEvent类,用于监听动作事件
|
|
|
|
import java.awt.event.ActionListener; // 导入ActionListener接口,用于实现动作事件监听
|
|
|
|
import java.awt.event.ActionListener; // 导入ActionListener接口,用于实现动作事件监听
|
|
|
|
import java.awt.event.MouseEvent; // 导入MouseEvent类,用于监听鼠标事件
|
|
|
|
import java.awt.event.MouseEvent; // 导入MouseEvent类,用于监听鼠标事件
|
|
|
@ -24,6 +25,7 @@ import javax.swing.JPanel; // 导入JPanel类,用于创建面板
|
|
|
|
import javax.swing.JSplitPane; // 导入JSplitPane类,用于创建分隔面板
|
|
|
|
import javax.swing.JSplitPane; // 导入JSplitPane类,用于创建分隔面板
|
|
|
|
import javax.swing.Timer; // 导入Timer类,用于实现定时器
|
|
|
|
import javax.swing.Timer; // 导入Timer类,用于实现定时器
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.lingnan.supermarket.componet.BGPanel; // 导入自定义的BGPanel类
|
|
|
|
import com.lingnan.supermarket.componet.BGPanel; // 导入自定义的BGPanel类
|
|
|
|
import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入BufferImpl类,可能是数据访问层的实现
|
|
|
|
import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入BufferImpl类,可能是数据访问层的实现
|
|
|
|
import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; // 导入inOrderServiceImpl类,可能是订单服务的实现
|
|
|
|
import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; // 导入inOrderServiceImpl类,可能是订单服务的实现
|
|
|
@ -38,8 +40,10 @@ import com.lingnan.supermarket.utils.DateUtil; // 导入DateUtil类,可能是
|
|
|
|
import com.lingnan.supermarket.utils.FontUtil; // 导入FontUtil类,可能是字体工具类
|
|
|
|
import com.lingnan.supermarket.utils.FontUtil; // 导入FontUtil类,可能是字体工具类
|
|
|
|
import com.lingnan.supermarket.view.base.BaseView; // 导入BaseView类,可能是视图基类
|
|
|
|
import com.lingnan.supermarket.view.base.BaseView; // 导入BaseView类,可能是视图基类
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.awt.*; // 导入awt包中的所有类
|
|
|
|
import java.awt.*; // 导入awt包中的所有类
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 主视图类,继承自BaseView,并实现多个事件监听接口
|
|
|
|
// 主视图类,继承自BaseView,并实现多个事件监听接口
|
|
|
|
public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{
|
|
|
|
public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{
|
|
|
|
|
|
|
|
|
|
|
@ -141,6 +145,8 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void refreshRemind() {
|
|
|
|
public static void refreshRemind() {
|
|
|
|
Vector<InOrder> vInOrder; // 声明未确认订单的向量
|
|
|
|
Vector<InOrder> vInOrder; // 声明未确认订单的向量
|
|
|
|
vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找所有未确认的订单
|
|
|
|
vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找所有未确认的订单
|
|
|
@ -228,12 +234,14 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
leftPanel.add(homeMenuLabel); // 将首页菜单标签添加到左侧面板
|
|
|
|
leftPanel.add(homeMenuLabel); // 将首页菜单标签添加到左侧面板
|
|
|
|
|
|
|
|
|
|
|
|
/*菜单栏:人员管理*/
|
|
|
|
/*菜单栏:人员管理*/
|
|
|
|
userMenuLabel = new JLabel("人员管理", new ImageIcon("static\\icon\\user1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示人员管理菜单
|
|
|
|
|
|
|
|
userMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式
|
|
|
|
userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT);
|
|
|
|
userMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器
|
|
|
|
userMenuLabel.setFont(FontUtil.menuFont);
|
|
|
|
userMenuLabel.setBounds(20, 300, 150, 32); // 设置菜单标签的位置和大小
|
|
|
|
userMenuLabel.addMouseListener(this);
|
|
|
|
userMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
|
|
|
|
userMenuLabel.setBounds(20, 300,150,32);
|
|
|
|
leftPanel.add(userMenuLabel); // 将人员管理菜单标签添加到左侧面板
|
|
|
|
userMenuLabel.setForeground(Color.white);
|
|
|
|
|
|
|
|
leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*菜单栏:进货系统*/
|
|
|
|
/*菜单栏:进货系统*/
|
|
|
|
inMenuLabel = new JLabel("进货系统", new ImageIcon("static\\icon\\in1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示进货系统菜单
|
|
|
|
inMenuLabel = new JLabel("进货系统", new ImageIcon("static\\icon\\in1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示进货系统菜单
|
|
|
@ -243,13 +251,15 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
inMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
|
|
|
|
inMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
|
|
|
|
leftPanel.add(inMenuLabel); // 将进货系统菜单标签添加到左侧面板
|
|
|
|
leftPanel.add(inMenuLabel); // 将进货系统菜单标签添加到左侧面板
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*菜单栏:收银系统*/
|
|
|
|
/*菜单栏:收银系统*/
|
|
|
|
outMenuLabel = new JLabel("收银系统", new ImageIcon("static\\icon\\out1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示收银系统菜单
|
|
|
|
outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT);
|
|
|
|
outMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式
|
|
|
|
outMenuLabel.setFont(FontUtil.menuFont);
|
|
|
|
outMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器
|
|
|
|
outMenuLabel.addMouseListener(this);
|
|
|
|
outMenuLabel.setBounds(20, 400, 150, 32); // 设置菜单标签的位置和大小
|
|
|
|
outMenuLabel.setBounds(20, 400,150,32);
|
|
|
|
outMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
|
|
|
|
outMenuLabel.setForeground(Color.white);
|
|
|
|
leftPanel.add(outMenuLabel); // 将收银系统菜单标签添加到左侧面板
|
|
|
|
leftPanel.add(outMenuLabel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*菜单栏:库存*/
|
|
|
|
/*菜单栏:库存*/
|
|
|
|
storageMenuLabel = new JLabel("商品库存", new ImageIcon("static\\icon\\storage1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示商品库存菜单
|
|
|
|
storageMenuLabel = new JLabel("商品库存", new ImageIcon("static\\icon\\storage1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示商品库存菜单
|
|
|
@ -268,12 +278,15 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
leftPanel.add(supplierMenuLabel); // 将供应商菜单标签添加到左侧面板
|
|
|
|
leftPanel.add(supplierMenuLabel); // 将供应商菜单标签添加到左侧面板
|
|
|
|
|
|
|
|
|
|
|
|
/*菜单栏:商品目录*/
|
|
|
|
/*菜单栏:商品目录*/
|
|
|
|
catalogMenuLabel = new JLabel("商品目录", new ImageIcon("static\\icon\\catalog1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel,用于表示商品目录菜单
|
|
|
|
|
|
|
|
catalogMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式
|
|
|
|
|
|
|
|
catalogMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器
|
|
|
|
|
|
|
|
catalogMenuLabel.setBounds(20, 550, 150, 32); // 设置菜单标签的位置和大小
|
|
|
|
catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT);
|
|
|
|
catalogMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
|
|
|
|
catalogMenuLabel.setFont(FontUtil.menuFont);
|
|
|
|
leftPanel.add(catalogMenuLabel); // 将商品目录菜单标签添加到左侧面板
|
|
|
|
catalogMenuLabel.addMouseListener(this);
|
|
|
|
|
|
|
|
catalogMenuLabel.setBounds(20,550,150,32);
|
|
|
|
|
|
|
|
catalogMenuLabel.setForeground(Color.white);
|
|
|
|
|
|
|
|
leftPanel.add(catalogMenuLabel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*提醒进货确认模块*/
|
|
|
|
/*提醒进货确认模块*/
|
|
|
@ -284,7 +297,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
remindMenuLabel.setForeground(Color.white); // 设置提醒菜单标签的前景色为白色
|
|
|
|
remindMenuLabel.setForeground(Color.white); // 设置提醒菜单标签的前景色为白色
|
|
|
|
leftPanel.add(remindMenuLabel); // 将提醒菜单标签添加到左侧面板
|
|
|
|
leftPanel.add(remindMenuLabel); // 将提醒菜单标签添加到左侧面板
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置右侧面板的布局管理器为卡片布局
|
|
|
|
// 设置右侧面板的布局管理器为卡片布局
|
|
|
|
|
|
|
|
|
|
|
|
rightPanelLayout = new CardLayout();
|
|
|
|
rightPanelLayout = new CardLayout();
|
|
|
|
|
|
|
|
|
|
|
|
// 0.超市首页展示,创建并实例化首页视图面板
|
|
|
|
// 0.超市首页展示,创建并实例化首页视图面板
|
|
|
@ -522,10 +537,12 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是用户菜单标签,则改变前景色和图标
|
|
|
|
// 如果事件源是用户菜单标签,则改变前景色和图标
|
|
|
|
if(source==userMenuLabel) {
|
|
|
|
if(source==userMenuLabel) {
|
|
|
|
|
|
|
|
|
|
|
|
userMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
userMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); // 设置鼠标进入时的图标
|
|
|
|
userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); // 设置鼠标进入时的图标
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是入库菜单标签,则改变前景色和图标
|
|
|
|
// 如果事件源是入库菜单标签,则改变前景色和图标
|
|
|
|
else if(source==inMenuLabel) {
|
|
|
|
else if(source==inMenuLabel) {
|
|
|
|
inMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
inMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
@ -550,6 +567,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); // 设置鼠标进入时的图标
|
|
|
|
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); // 设置鼠标进入时的图标
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是目录菜单标签,则改变前景色和图标
|
|
|
|
// 如果事件源是目录菜单标签,则改变前景色和图标
|
|
|
|
else if(source==catalogMenuLabel) {
|
|
|
|
else if(source==catalogMenuLabel) {
|
|
|
|
catalogMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
catalogMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
@ -557,6 +575,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是用户菜单标签1,则改变前景色
|
|
|
|
// 如果事件源是用户菜单标签1,则改变前景色
|
|
|
|
|
|
|
|
|
|
|
|
else if(source==userMenuLabel1) {
|
|
|
|
else if(source==userMenuLabel1) {
|
|
|
|
userMenuLabel1.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
userMenuLabel1.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
|
|
|
|
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标进入图标
|
|
|
|
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标进入图标
|
|
|
@ -577,6 +596,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); // 设置鼠标离开时的默认图标
|
|
|
|
homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); // 设置鼠标离开时的默认图标
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是用户菜单标签,则恢复前景色和图标
|
|
|
|
// 如果事件源是用户菜单标签,则恢复前景色和图标
|
|
|
|
else if(source==userMenuLabel) {
|
|
|
|
else if(source==userMenuLabel) {
|
|
|
|
userMenuLabel.setForeground(Color.white); // 恢复前景色为白色
|
|
|
|
userMenuLabel.setForeground(Color.white); // 恢复前景色为白色
|
|
|
@ -607,13 +627,11 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
|
|
|
|
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); // 设置鼠标离开时的默认图标
|
|
|
|
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); // 设置鼠标离开时的默认图标
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源是目录菜单标签,则恢复前景色和图标
|
|
|
|
|
|
|
|
else if(source==catalogMenuLabel) {
|
|
|
|
else if(source==catalogMenuLabel) {
|
|
|
|
catalogMenuLabel.setForeground(Color.white); // 恢复前景色为白色
|
|
|
|
catalogMenuLabel.setForeground(Color.white);
|
|
|
|
catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); // 设置鼠标离开时的默认图标
|
|
|
|
catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果事件源不是上述任何一个标签,则默认处理用户菜单标签1
|
|
|
|
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
userMenuLabel1.setForeground(Color.white); // 恢复前景色为白色
|
|
|
|
userMenuLabel1.setForeground(Color.white); // 恢复前景色为白色
|
|
|
|
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标离开图标
|
|
|
|
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标离开图标
|
|
|
|