基于Java语言编写的超市管理系统,基于JavaFX构建的图形化界面

开发起因

学校实训分组要求每小组交一份实训项目,本小组共有3人,一人后端,两人前端

下面是另两位大佬csdn账号😘

Themberfueicon-default.png?t=N7T8https://blog.csdn.net/Themberfue?type=blogPxoolcmicon-default.png?t=N7T8https://blog.csdn.net/2303_79441076?type=blog


项目介绍

先附上项目UML图

登陆注册

首先进来的登录界面,通过登录来进入客户,仓库管理人员,收银人员的专属界面,注册界面只能用于客户的注册,其他两个人员账号密码事先存在数据库里了😁

勾选成为黑市Plus用户后,跳转至支付界面🤣

仓库管理人员界面

功能如图所示

收银员管理页面

功能如图所示

普通客户页面

功能如图所示

Plus客户页面

Plus客户相对普通用户商品价格打8折

数据库建表展示

.sql文件已经附在了Github仓库里了,有需要自行下载使用。


功能完善

注册登录功能基本齐全

未完成部分如下:

时间问题:客户功能中购物车已选购物品展示与结账功能,客户个人信息保存功能,Plus客户积分制度

能力问题:仓库管理人员功能通知与警报功能(这玩意其实也没什么好完善的🤣)


个人总结or碎碎念?

我主要与伙伴1一起完成前端页面,当时要求实训项目要求前端使用javafx,但当时并未学习过javafx,这位伙伴
1二话不说直接0基础开学😱,我靠,这你受的了吗,还好在伙伴1的教导下也是勉强学会了一点基础(至少不是纯纯凑人数的了🥵)而我们的后端全交给了伙伴2,为啥呢?因为他在我们实训之前就学完了🤣

好了讲正事,我主要是写了注册页面勾选成为Plus客户后面一系列的页面(里面东西很好玩哦!前面没有展示出来)还有收银员管理页面及客户页面的框架和一点点功能实现

讲点收获,就是关于在三个主要页面点击按钮后centerLayout的跳转及按钮变化

这里是将两种按钮样式设置了String,后面将各个按钮设置为初始状态样式

//创建style
        String defaultLeftSideButton = "-fx-background-color: #DCDCDC; -fx-text-fill: #696969; -fx-padding: 20; -fx-cursor: hand";
        String selectedLeftSideButton = "-fx-background-color: #696969; -fx-text-fill: white; -fx-padding: 20; -fx-cursor: hand";

        //按钮
        Button customerInfoButton = createLeftSideButton("客户信息管理", "/customer_info.png");
        Button customerOrderButton = createLeftSideButton("客户订单查询", "/customer_order.png");
        Button salesProcessingButton = createLeftSideButton("销售处理", "/sales_processing.png");
        Button afterSalesServiceButton = createLeftSideButton("售后服务", "/after-sales_service.png");

        customerInfoButton.setStyle(selectedLeftSideButton);
        customerOrderButton.setStyle(defaultLeftSideButton);
        salesProcessingButton.setStyle(defaultLeftSideButton);
        afterSalesServiceButton.setStyle(defaultLeftSideButton);

这里创建了一个方法将每个按钮,当前点击按钮,两种按钮样式和新页面传入其中,随后遍历每个按钮将其设为默认样式再将点击按钮设置为点击样式,再将centerLayout清空再加入新页面                  

//点击改变按钮
        addLeftSideButtonClick(customerInfoButton, new Button[]{customerInfoButton, customerOrderButton, salesProcessingButton, afterSalesServiceButton}, selectedLeftSideButton, defaultLeftSideButton, centerLayout, new CustomerInfoView());
        addLeftSideButtonClick(customerOrderButton, new Button[]{customerInfoButton, customerOrderButton, salesProcessingButton, afterSalesServiceButton}, selectedLeftSideButton, defaultLeftSideButton, centerLayout, new CustomerOrderView());
        addLeftSideButtonClick(salesProcessingButton, new Button[]{customerInfoButton, customerOrderButton, salesProcessingButton, afterSalesServiceButton}, selectedLeftSideButton, defaultLeftSideButton, centerLayout, new SalesProcessingView());
        addLeftSideButtonClick(afterSalesServiceButton, new Button[]{customerInfoButton, customerOrderButton, salesProcessingButton, afterSalesServiceButton}, selectedLeftSideButton, defaultLeftSideButton, centerLayout, new AfterSalesServiceView(primaryStage));

    // 点击改变按钮
    private void addLeftSideButtonClick(Button button, Button[] allButtons, String selectedStyle, String defaultStyle, VBox centerLayout, Pane content) {
        button.setOnAction(e -> {
            for (Button btn : allButtons) {
                btn.setStyle(defaultStyle);
            }
            button.setStyle(selectedStyle);
            centerLayout.getChildren().clear();
            centerLayout.getChildren().add(content);
        });

        // 添加鼠标悬停和离开事件的辅助方法
        button.setOnMouseEntered(e -> {
            if (!button.getStyle().equals(selectedStyle)) {
                button.setStyle("-fx-background-color: #A9A9A9; -fx-text-fill: white; -fx-padding: 20; -fx-cursor: hand;");
            }
        });
        button.setOnMouseExited(e -> {
            if (!button.getStyle().equals(selectedStyle)) {
                button.setStyle(defaultStyle);
            }
        });
    }

源代码

本项目已在Github开源(不要吝啬你的小星星哦😍)

超市管理系统icon-default.png?t=N7T8https://github.com/zhaojinlukui/SupermarketManagementSystem


ok啦!终于搞完了😆这是我的第一篇博客 虽然不知道接下来要写啥但是还是会尽量写下去的✌️

  • 20
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值