首页 >> 大全

Java GUI 实现工资管理系统

2023-12-31 大全 24 作者:考证青年

工资管理系统(Java++JDBC实现),使用mysql存储数据。 主要的要求如下:

建立职工工资管理系统,要求实现职工基本信息管理(编号、姓名、性别、初始年月、工资等级等)、工资等级情况管理(工资等级、基本工资、岗位工资、交通补贴等)、每月职工变动工资管理(职工编号、月份、奖励工资、扣款等),并根据职工的工资等级以及每月职工的变动工资情况自动生成每月职工的工资信息,并实现对员工工资的排序输出等操作。

花了一周的时间和我的小伙伴终于完成了Java的课设,下面来展示一下我们部分功能吧,有些界面可能尚未完善。

首先看看我们的工资管理系统功能模块结构图设计:

再瞅瞅我们的设计类图:

enmm,接下来进入正题,来看看我们的登录界面吧:

我们的用户名和密码都是admin,当输入错误时会显示如下:

那么再看看我们是如何实现这个登录界面的吧,首先我们使用的是Java swing组件,首先我们设置了一个蓝色的左面板,中间有白色的名字,然后对组件进行排版设置样式

那么接下来再看看我们的我们的主页面吧,就是一个仪表盘哈哈哈

_工资管理系统设计java_工资管理系统的用例图

我们导航栏中有四个按钮,员工管理的如下

汇总查询具有四个功能,可以查看所有部门员工的工资等级,以一张表的形式展现出来,汇总查询的如下:

好啦,咋门进入正题,对员工等级进行新增操作:

好的,你选择了技术人员,对技术人员工资等级进行操作,界面有点丑陋,哈哈

再瞅瞅我们修改工资等级页面

你选择了技术部的一级,并且对它进行修改,如下:

对于删除界面,首先要选择部门,然后选择你需要删除的部门的工资等级,然后点击确认即可删除

查询工资等级功能,选择岗位部门,然后选择工资等级即可跳转出来我们需查询的内容。

样例如下:

然后看看我们总的工资等级吧,这里就展示技术人员的工资等级吧

对于修改工资变动这,我们首先查找一下数据库中有没有该工号的员工,如果不存在该工号,就会跳出弹窗提醒不存在该员工提醒用户

最后来使用一下我们的汇总查询

点击汇总查询生成本月的所有员工的工资信息,并且对总工资进行一个降序排列进行展示在一张表中

这里大概展示这些基本功能,能力有限,做的比较的粗糙,哈哈哈

下面展示一下登录界面如何实现,后期会将整个放在上

package bwc04.view;import bwc04.tools.border.Borders;
import bwc04.tools.color.Colour;
import bwc04.tools.font.Fonts;
import bwc04.tools.image.Images;
import bwc04.tools.placeholder.Placeholder;
import bwc04.tools.view.View;import javax.swing.*;
import java.awt.*;/*** 登录窗体* @author KSamer* @version 1.0*/
public class LoginView extends JFrame {/*** 标题信息*/private String subTitle = "工资管理系统-登录";/*** 组件信息*/private String loginButtonText = "登录";/*** 提示文本信息*/private String usernamePlaceholder = "用户名";private String passwordPlaceholder = "密码";private String emptyUsernameText = "请输入用户名";private String emptyPasswordText = "请输入密码";private String errorText = "用户名或密码错误";/*** 标签*/private JLabel titleLabel = new JLabel();private JLabel loginTitleLabel = new JLabel();private JLabel loginMessageLabel = new JLabel();/*** 按钮*/private JButton closeButton = new JButton();private JButton loginButton = new JButton();/*** 输入框*/private JTextField usernameField = new JTextField();private JPasswordField passwordField = new JPasswordField();/*** 面板*/private JPanel leftPanel = new JPanel();private JPanel rightPanel = new JPanel();/*** 登录窗体* @param title 登录窗体标题*/public LoginView(String title) {// 关闭按钮closeButton.setIcon(Images.closeButtonIcon);closeButton.setRolloverIcon(Images.closeButtonHoverIcon);closeButton.setBounds(660, 20, 20, 20);closeButton.setOpaque(false);closeButton.setContentAreaFilled(false);closeButton.setFocusPainted(false);closeButton.setBorder(null);closeButton.addActionListener(e -> System.exit(0));// 左面板标题titleLabel.setText(title);titleLabel.setBounds(0, 220, 350, 30);titleLabel.setFont(Fonts.title);titleLabel.setForeground(Color.WHITE);titleLabel.setHorizontalAlignment(SwingConstants.CENTER);// 左面板leftPanel.setLayout(null);leftPanel.setBounds(0, 0, 350, 500);leftPanel.setBackground(Colour.C3C8CE7);leftPanel.add(titleLabel);// 右面板标题loginTitleLabel.setText(subTitle);loginTitleLabel.setBounds(0, 120, 350, 30);loginTitleLabel.setFont(Fonts.title);loginTitleLabel.setHorizontalAlignment(SwingConstants.CENTER);// 用户名输入框usernameField.setBounds(55, 200, 240, 36);usernameField.setBorder(Borders.textFiledBorder);usernameField.setHorizontalAlignment(SwingConstants.CENTER);usernameField.setFont(Fonts.textField);usernameField.addFocusListener(Placeholder.focusListener(usernameField, usernamePlaceholder));Placeholder.setPlaceholder(usernameField, usernamePlaceholder, Color.LIGHT_GRAY);// 密码输入框Placeholder.setPlaceholder(passwordField, passwordPlaceholder, Color.LIGHT_GRAY);passwordField.setEchoChar('\0');passwordField.setBounds(55, 260, 240, 36);passwordField.setBorder(Borders.textFiledBorder);passwordField.setHorizontalAlignment(SwingConstants.CENTER);passwordField.setFont((Fonts.textField));passwordField.addFocusListener(Placeholder.focusListener(passwordField, passwordPlaceholder));// 登录按钮loginButton.setText(loginButtonText);loginButton.setBounds(55, 320, 240, 36);loginButton.setForeground(Color.WHITE);loginButton.setFont(Fonts.button);loginButton.setBackground(Colour.C3C8CE7);loginButton.setFocusPainted(false);loginButton.setBorder(null);loginButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));loginButton.addActionListener(e -> login());// 登录信息loginMessageLabel.setBounds(55, 380, 240, 24);loginMessageLabel.setHorizontalAlignment(SwingConstants.CENTER);loginMessageLabel.setForeground(Color.RED);loginMessageLabel.setFont(Fonts.loginMessage);// 右面板rightPanel.setLayout(null);rightPanel.setBounds(350, 0, 350, 500);rightPanel.setBackground(Color.WHITE);rightPanel.add(loginTitleLabel);rightPanel.add(usernameField);rightPanel.add(passwordField);rightPanel.add(loginButton);rightPanel.add(loginMessageLabel);// 添加组件add(closeButton);add(leftPanel);add(rightPanel);// 设置标题setTitle(title);// 设置大小setSize(700, 500);// 设置窗体默认关闭方式setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 设置窗体不可编辑setResizable(false);// 设置窗体无边框setUndecorated(true);// 设置窗体布局setLayout(null);// 设置窗口焦点setFocusable(true);// 设置窗体是否可见setVisible(true);// 设置窗体居中setLocationRelativeTo(null);// 设置窗体图标setIconImage(Images.systemImage);// 设置窗体无边框移动View.setMoveFrame(this);}/*** 登录事件*/public void login() {String username = usernameField.getText();String password = new String(passwordField.getPassword());if ("".equals(username) || usernamePlaceholder.equals(username)) {loginMessageLabel.setText(emptyUsernameText);}else if ("".equals(password) || passwordPlaceholder.equals(password)) {loginMessageLabel.setText(emptyPasswordText);}else {int result = new LoginController().login(username, password);if (result == 1) {new AdminView();dispose();}else {loginMessageLabel.setText(errorText);}}}}

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了