Merge branch 'main' into branch_zyx

# Conflicts:
#	test.txt3
branch_zyx
郑亦歆 9 months ago
commit f19c4fa975

@ -3,5 +3,5 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="21" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

@ -6,6 +6,6 @@
<classpathentry kind="src" path="config"/>
<classpathentry kind="lib" path="Supermarket/lib/activation.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mail.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mysql-connector-java-5.1.32.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mysql-connector-java-8.0.20.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -2,7 +2,7 @@
<project version="4">
<component name="dataSourceStorageLocal" created-in="IU-231.8109.175">
<data-source name="@localhost" uuid="5b23e521-053a-47c0-ae28-a98b513bc6ec">
<database-info product="MySQL" version="5.7.44-log" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="5.7.44" exact-driver-version="8.2">
<database-info product="MySQL" version="8.4.0" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="8.4.0" exact-driver-version="8.2">
<extra-name-characters>#@</extra-name-characters>
<identifier-quote-string>`</identifier-quote-string>
</database-info>

@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="mysql.connector.java" type="repository">
<properties maven-id="mysql:mysql-connector-java:8.0.20" />
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/mysql-connector-java-8.0.20.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/protobuf-java-3.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/activation.jar" />
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/mail.jar" />
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/mysql-connector-java-5.1.32.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/activation.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/mail.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/mysql-connector-java-5.1.32.jar" />
<src_description expected_position="1">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
<src_folder value="file://$MODULE_DIR$" expected_position="1" />
@ -47,5 +47,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="mysql.connector.java" level="project" />
</component>
</module>

@ -6,6 +6,6 @@
<classpathentry kind="src" path="config"/>
<classpathentry kind="lib" path="Supermarket/lib/activation.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mail.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mysql-connector-java-5.1.32.jar"/>
<classpathentry kind="lib" path="Supermarket/lib/mysql-connector-java-8.0.20.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -2,7 +2,7 @@
<project version="4">
<component name="dataSourceStorageLocal" created-in="IU-231.8109.175">
<data-source name="@localhost" uuid="5b23e521-053a-47c0-ae28-a98b513bc6ec">
<database-info product="MySQL" version="5.7.44-log" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="5.7.44" exact-driver-version="8.2">
<database-info product="MySQL" version="8.4.0" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-j-8.2.0 (Revision: 06a1f724497fd81c6a659131fda822c9e5085b6c)" dbms="MYSQL" exact-version="8.4.0" exact-driver-version="8.2">
<extra-name-characters>#@</extra-name-characters>
<identifier-quote-string>`</identifier-quote-string>
</database-info>

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/activation.jar" />
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/mail.jar" />
<libelement value="file://D:/大二下学期实训超市管理系统/Supermarket/lib/mysql-connector-java-5.1.32.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/activation.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/mail.jar" />
<libelement value="file://$MODULE_DIR$/../../../大二下学期实训超市管理系统/Supermarket/lib/mysql-connector-java-5.1.32.jar" />
<src_description expected_position="1">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
<src_folder value="file://$MODULE_DIR$" expected_position="1" />
@ -47,5 +47,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="mysql.connector.java" level="project" />
</component>
</module>

@ -1,4 +1,4 @@
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket?serverTimezone=UTC
user=root
password=123456
password=040820

@ -1,4 +1,4 @@
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket?serverTimezone=UTC
user=root
password=123456
password=040820

@ -1,4 +1,4 @@
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/supermarket?serverTimezone=UTC
user=root
password=123456
password=040820

@ -52,9 +52,10 @@ public class inOrderServiceImpl implements inOrderService{
try {
// 准备SQL语句根据订单号查找特定的订单
preparedStatement = conn.prepareStatement("select * from inOrder where iNumber = ?");
preparedStatement = conn.prepareStatement("select * from inOrder where iNumber = ?"); //根据订单号查询订单
preparedStatement.setString(1, iNumber); // 设置订单号参数
resultSet = preparedStatement.executeQuery(); // 执行查询
// 设置查询到的订单的属性到InOrder对象中
if (resultSet.next()) { // 如果找到对应记录
// 从结果集中获取属性并设置到inOrder对象
inOrder.setiNumber(resultSet.getString("iNumber"));

@ -486,7 +486,7 @@ public class InView extends JPanel implements ActionListener{
CreateOrder createOrder = new CreateOrder();
String OrderText = createOrder.CreateOrder(v, s[0], s[1], allPrice,uname);
try {/*发送邮件*/
SendQQMailUtil QQEmail = new SendQQMailUtil("sender@qq.com","自行获取 SMTP 授权码","receiver@qq.com","@新民超市进货需求申请",OrderText);
SendQQMailUtil QQEmail = new SendQQMailUtil("cwfeng5@qq.com","wlcinslohrgpdiac","1912638153@qq.com","@新民超市进货需求申请",OrderText);
} catch (MessagingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();

@ -41,77 +41,77 @@ import com.lingnan.supermarket.view.base.BaseView;
import java.awt.*;
public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{
JMenuBar menuBar;
JMenu settingMenu,helpMenu;
JMenuItem skinMenuItem,configMenuItem;
JSplitPane containerPanel;
CardLayout rightPanelLayout;
JPanel leftPanel,rightPanel;
/*菜单栏*/
JLabel logoLabel,userMenuLabel1,homeMenuLabel,userMenuLabel,inMenuLabel,
outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel;
outMenuLabel,storageMenuLabel,supplierMenuLabel,catalogMenuLabel;
static JLabel remindMenuLabel;/*全局调用刷新*/
JPanel bottomPanel;
JLabel timeLabel;
JPanel purposePanel,timePanel;
JLabel purposeLabel;
JButton saveBtn,unSaveBtn,cancleBtn;/*退出时按钮*/
//
Timer timer;
private User user ;/*从登录界面传过来的用户信息*/
private BufferImpl bufferImpl;
private Image bgImage ;
private String iconSkin;
private int skin;
private Vector<Production> vP=new Vector<Production>() ;/*用于进货缓存*/
private int location;
private int sSuper=-1;//界面权限
private static inOrderServiceImpl inOrderImpl = new inOrderServiceImpl();
private static int unConfirmmark;/*未确认订单*/
public MainView(User user,int skin,String iconSkin) {
super(1300,850,"新民超市管理系统欢迎您",user,skin);
timer = new Timer(1000,this);
timer.start();
this.user = user;
this.sSuper=user.getUsuper();//界面权限
System.out.println("userid="+user.getId());
this.addWindowListener(this);
this.skin = skin;
this.iconSkin = iconSkin;
ImageIcon icon=new ImageIcon(iconSkin); //xxx代表图片存放路径2.png图片名称及格式
this.setIconImage(icon.getImage());
//获得未进货的信息
Vector<InOrder> vInOrder;
vInOrder = inOrderImpl.findUnconfirmInOrder();
unConfirmmark=vInOrder.size();
initView(user,skin);
}
@ -120,50 +120,49 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
timer = new Timer(1000,this);
timer.start();
this.user = user;
this.sSuper=user.getUsuper();//界面权限
System.out.println("userid="+user.getId());
this.addWindowListener(this);
//获得未进货的信息
Vector<InOrder> vInOrder;
vInOrder = inOrderImpl.findUnconfirmInOrder();
unConfirmmark=vInOrder.size();
initView(user,skin);
}
public static void refreshRemind() {
Vector<InOrder> vInOrder;
vInOrder = inOrderImpl.findUnconfirmInOrder();
unConfirmmark=vInOrder.size();
remindMenuLabel.setText("待确认进货:"+unConfirmmark);
}
/* public static User getUserInf() {
return user;
}*/
@Override
protected void initView(User user,int skin) {
/*菜单栏*/
menuBar = new JMenuBar();
settingMenu = new JMenu("设置");
helpMenu = new JMenu("帮助");
skinMenuItem = new JMenuItem("随机切换皮肤",new ImageIcon("static\\icon\\skin.png"));
/* for(int i = 3;i<9;i++) {
@ -171,36 +170,36 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
}*/
configMenuItem = new JMenuItem("参数设置",new ImageIcon("static\\icon\\setting.png"));
skinMenuItem.addActionListener(this);
settingMenu.add(configMenuItem);
settingMenu.add(skinMenuItem);
menuBar.add(settingMenu);
menuBar.add(helpMenu);
setJMenuBar(menuBar);
/*左边菜单栏设置*/
try {
bgImage = ImageIO.read(new File("static\\bg\\bg"+skin+".jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
leftPanel = new BGPanel(bgImage);/*皮肤*/
leftPanel.setLayout(null);
/*菜单栏:用户登录信息*/
System.out.println("用户头像地址=="+user.getImg());
JLabel logoLabel = new JLabel(new ImageIcon(user.getImg()),JLabel.LEFT);
System.out.println(user.getImg());
leftPanel.add(logoLabel);
logoLabel.setBounds(25, 30,150,150);
/*账号名字*/
String x = UsuperIcon(user.getUsuper());/*判断权限返回icon地址*/
System.out.println("身份地址:"+x);
@ -210,9 +209,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
userMenuLabel1.setBounds(20, 170,180,32);
userMenuLabel1.setForeground(Color.white);
leftPanel.add(userMenuLabel1);/*添加用户选项到菜单栏*/
/*菜单栏:首页*/
homeMenuLabel = new JLabel("新民首页",new ImageIcon("static\\icon\\home1.png"),JLabel.LEFT);
homeMenuLabel.setFont(FontUtil.menuFont);
@ -220,9 +219,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
homeMenuLabel.setBounds(20, 250,150,32);
homeMenuLabel.setForeground(Color.white);
leftPanel.add(homeMenuLabel);/*添加用户选项到菜单栏*/
/*菜单栏:人员管理*/
userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT);
userMenuLabel.setFont(FontUtil.menuFont);
@ -230,7 +229,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
userMenuLabel.setBounds(20, 300,150,32);
userMenuLabel.setForeground(Color.white);
leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/
/*菜单栏:进货系统*/
inMenuLabel = new JLabel("进货系统",new ImageIcon("static\\icon\\in1.png") ,JLabel.LEFT);
inMenuLabel.setFont(FontUtil.menuFont);
@ -238,7 +237,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
inMenuLabel.setBounds(20, 350,150,32);
inMenuLabel.setForeground(Color.white);
leftPanel.add(inMenuLabel);
/*菜单栏:收银系统*/
outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT);
outMenuLabel.setFont(FontUtil.menuFont);
@ -246,7 +245,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
outMenuLabel.setBounds(20, 400,150,32);
outMenuLabel.setForeground(Color.white);
leftPanel.add(outMenuLabel);
/*菜单栏:库存*/
storageMenuLabel = new JLabel("商品库存",new ImageIcon("static\\icon\\storage1.png") ,JLabel.LEFT);
storageMenuLabel.setFont(FontUtil.menuFont);
@ -254,7 +253,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
storageMenuLabel.setBounds(20, 450,150,32);
storageMenuLabel.setForeground(Color.white);
leftPanel.add(storageMenuLabel);
/*菜单栏:供应商*/
supplierMenuLabel = new JLabel("供应商",new ImageIcon("static\\icon\\supplier1.png") ,JLabel.LEFT);
supplierMenuLabel.setFont(FontUtil.menuFont);
@ -262,7 +261,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
supplierMenuLabel.setBounds(20, 500,150,32);
supplierMenuLabel.setForeground(Color.white);
leftPanel.add(supplierMenuLabel);
/*菜单栏:商品目录*/
catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT);
catalogMenuLabel.setFont(FontUtil.menuFont);
@ -270,7 +269,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
catalogMenuLabel.setBounds(20,550,150,32);
catalogMenuLabel.setForeground(Color.white);
leftPanel.add(catalogMenuLabel);
/*提醒进货确认模块*/
remindMenuLabel = new JLabel("待确认进货:"+unConfirmmark,new ImageIcon("static\\icon\\remind1.png") ,JLabel.LEFT);
remindMenuLabel.setFont(FontUtil.remindFont);
@ -278,37 +277,37 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
remindMenuLabel.setBounds(0,650,200,32);
remindMenuLabel.setForeground(Color.white);
leftPanel.add(remindMenuLabel);
rightPanelLayout = new CardLayout();
//0.超市首页展示
JPanel homePanel = new HomeView(this);
//1.用户管理界面:用户的列表
JPanel userPanel = new UserView(this);
//2.进货系统界面
JPanel inPanel = new InView(this,user,vP,1);
//3收银系统界面
JPanel outPanel = new OutView(this,user);
//4.库存系统界面
JPanel storagePanel = new StorageView(this);
//5.供应商界面
JPanel supplierPanel = new SupplierView(this);
//6商品目录界面
JPanel ProdCatalogPanel = new ProdCatalogView(this);
//7商品目录界面
JPanel superPanel = new SuperView(this);
//8进货信息提示
JPanel inPanel2 = new InView(this,user,vP,0);
/*添加界面并给索引*/
rightPanel = new JPanel(rightPanelLayout);
rightPanel.add(homePanel, "0");
@ -320,29 +319,29 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
rightPanel.add(ProdCatalogPanel, "6");
rightPanel.add(superPanel, "7");
rightPanel.add(inPanel2, "8");
containerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel,rightPanel);
containerPanel.setDividerLocation(180);
containerPanel.setDividerSize(0);
bottomPanel = new JPanel();//默认的布局是流式布局
bottomPanel.setBackground(Color.WHITE);
bottomPanel.setLayout(new BorderLayout());
purposePanel = new JPanel();
purposePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
purposePanel.setBackground(Color.WHITE);
purposeLabel = new JLabel("当前位置是:超市首页");
purposePanel.add(purposeLabel);
timePanel=new JPanel();
timePanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
timePanel.setBackground(Color.WHITE);
timeLabel = new JLabel(DateUtil.dateToString(new Date(),null));
timePanel.add(timeLabel);
bottomPanel.add(purposePanel,"West");
bottomPanel.add(timePanel,"East");
Container container = getContentPane();
@ -361,96 +360,153 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
this.dispose();
new MainView(user,skin,iconSkin);
}
}
@Override/*左侧菜单栏点击事件*/
/**
* cwf 2024/12/11
*
*/
@Override
/* 左侧菜单栏点击事件 */
public void mouseClicked(MouseEvent e) {
Object source = e.getSource();
if(source==homeMenuLabel) {
rightPanelLayout.show(rightPanel,"0");
location=0;
}else if(source==userMenuLabel) {
if(sSuper==0)
rightPanelLayout.show(rightPanel,"1");
else{
rightPanelLayout.show(rightPanel,"7");
Object source = e.getSource(); // 获取点击事件的来源
// 如果点击的是首页菜单
if (source == homeMenuLabel) {
rightPanelLayout.show(rightPanel, "0"); // 显示首页界面
location = 0; // 设置当前位置为首页
}
// 如果点击的是人员管理菜单
else if (source == userMenuLabel) {
// 如果用户是管理员 (sSuper == 0) 或进货员 (sSuper == 1)
if (sSuper == 0 || sSuper == 1) {
rightPanelLayout.show(rightPanel, "1"); // 显示人员管理界面
}
// 如果用户是普通用户 (sSuper == 3)
else if (sSuper == 3) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如普通用户权限)
else {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
location = 1; // 设置当前位置为人员管理
}
// 如果点击的是进货系统菜单
else if (source == inMenuLabel) {
// 如果用户是普通用户 (sSuper == 2) 或进货员 (sSuper == 1)
if (sSuper == 2 || sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "2"); // 显示进货系统界面
}
location=1;
location = 2; // 设置当前位置为进货系统
}
else if(source==inMenuLabel) {
if(sSuper==2)
rightPanelLayout.show(rightPanel,"7");
else{
rightPanelLayout.show(rightPanel,"2");
// 如果点击的是收银系统菜单
else if (source == outMenuLabel) {
// 如果用户是普通用户 (sSuper == 3) 或进货员 (sSuper == 1)
if (sSuper == 3 || sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "3"); // 显示收银系统界面
location = 3; // 设置当前位置为收银系统
}
location=2;
}
else if(source==outMenuLabel) {
rightPanelLayout.show(rightPanel,"3");
location=3;
// 如果点击的是库存系统菜单
else if (source == storageMenuLabel) {
// 如果用户是进货员 (sSuper == 1)
if (sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "4"); // 显示库存系统界面
location = 4; // 设置当前位置为库存系统
}
}
else if(source==storageMenuLabel) {
rightPanelLayout.show(rightPanel,"4");
location=4;
// 如果点击的是供应商菜单
else if (source == supplierMenuLabel) {
// 如果用户是进货员 (sSuper == 1)
if (sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "5"); // 显示供应商界面
location = 5; // 设置当前位置为供应商
}
}
else if(source==supplierMenuLabel) {
rightPanelLayout.show(rightPanel,"5");
location=5;
// 如果点击的是商品目录菜单
else if (source == catalogMenuLabel) {
// 如果用户是进货员 (sSuper == 1)
if (sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "6"); // 显示商品目录界面
location = 6; // 设置当前位置为商品目录
}
}
else if(source==catalogMenuLabel) {
rightPanelLayout.show(rightPanel,"6");
location=6;
}else if(source==remindMenuLabel) {
if(sSuper==2)
rightPanelLayout.show(rightPanel,"7");
else{
rightPanelLayout.show(rightPanel,"8");
// 如果点击的是提醒菜单
else if (source == remindMenuLabel) {
// 如果用户是普通用户 (sSuper == 2) 或进货员 (sSuper == 1)
if (sSuper == 2 || sSuper == 1) {
rightPanelLayout.show(rightPanel, "7"); // 显示普通用户界面
}
location=7;
}else if(source==userMenuLabel1){
UserInfDialog userInfDialog = new UserInfDialog(this,user);
userInfDialog.setVisible(true);
location=8;
// 其他情况(例如管理员权限)
else {
rightPanelLayout.show(rightPanel, "8"); // 显示进货信息提示界面
}
location = 7; // 设置当前位置为提醒
}
// 如果点击的是用户信息菜单
else if (source == userMenuLabel1) {
UserInfDialog userInfDialog = new UserInfDialog(this, user); // 创建用户信息对话框
userInfDialog.setVisible(true); // 显示用户信息对话框
location = 8; // 设置当前位置为用户信息
}
refreshRemove();
refreshRemove(); // 刷新当前界面的位置信息
}
//获取当前位置
public void refreshRemove(){
public void refreshRemove(){
purposePanel.removeAll();
if(location==0){
purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText());
}else if(location==1){
purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText());
}else if(location==2){
purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText());
}else if(location==3){
purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText());
}else if(location==4){
purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText());
}else if(location==5){
purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText());
}else{
purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText());
}
purposePanel.add(purposeLabel);
purposePanel.removeAll();
if(location==0){
purposeLabel = new JLabel("当前位置是:"+homeMenuLabel.getText());
}else if(location==1){
purposeLabel = new JLabel("当前位置是:"+userMenuLabel.getText());
}else if(location==2){
purposeLabel = new JLabel("当前位置是:"+inMenuLabel.getText());
}else if(location==3){
purposeLabel = new JLabel("当前位置是:"+outMenuLabel.getText());
}else if(location==4){
purposeLabel = new JLabel("当前位置是:"+storageMenuLabel.getText());
}else if(location==5){
purposeLabel = new JLabel("当前位置是:"+supplierMenuLabel.getText());
}else{
purposeLabel = new JLabel("当前位置是:"+catalogMenuLabel.getText());
}
purposePanel.add(purposeLabel);
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
@ -460,9 +516,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override/*鼠标焦点时*/
public void mouseEntered(MouseEvent e) {
Object source = e.getSource();
@ -488,21 +544,19 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
}else if(source==catalogMenuLabel) {
catalogMenuLabel.setForeground(new Color(18, 150, 219));
catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog2.png"));
}
else if(source==userMenuLabel1) {
} else if(source==userMenuLabel1) {
userMenuLabel1.setForeground(new Color(18, 150, 219));
}
}
}
@Override
public void mouseExited(MouseEvent e) {
Object source = e.getSource();
Object source = e.getSource();
if(source==homeMenuLabel) {
homeMenuLabel.setForeground(Color.white);
homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png"));
}
else if(source==userMenuLabel) {
} else if(source==userMenuLabel) {
userMenuLabel.setForeground(Color.white);
userMenuLabel.setIcon(new ImageIcon("static\\icon\\user1.png"));
}else if(source==inMenuLabel) {
@ -520,31 +574,30 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
}else if(source==catalogMenuLabel) {
catalogMenuLabel.setForeground(Color.white);
catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png"));
}
else {
} else {
userMenuLabel1.setForeground(Color.white);
}
}
}
@Override
protected void initView() {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
Object source = e.getSource();
Object source = e.getSource();
if(source==this) {/*关闭窗口时检查进货系统和出货系统是否还有记录*/
this.vP =InView.getVector();
System.out.println("v的size="+vP.size());
@ -554,7 +607,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
closeDialog.setVisible(true);
}else
System.exit(0);
}
}
@ -562,31 +615,31 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}

@ -3,4 +3,16 @@ z1 z2 13131
d11111
d2
Z3
d3
d4w
d5
d6
d7
顶顶顶
444444
11111

Loading…
Cancel
Save