今天为大家分享一个java语言的超市进销存管理系统,目前系统已经完成了初步功能,后续会进一步完善。整个系统界面漂亮,有完整得源码,希望大家可以喜欢。喜欢的帮忙点赞和关注。一起编程、一起进步
开发环境
开发语言为Java,开发环境Eclipse或者IDEA都可以,数据为MySQL。运行主程序,或者执行打开JAR文件即可以运行本程序。
系统框架
利用JDK自带的SWING框架开发,下载。纯窗体模式,直接运行Main文件即可以。同时带有详细得设计文档。
主要功能
开发背景
随着中国经济的快速发展,我国每年出品电影数量位居世界前列,从事电影行业的人数也比较庞大。电影的质量也越来越高,屡次在国际三大电影节中(意大利的威尼斯国际电影节、法国的戛纳国际电影节和德国的柏林国际电影节)获奖,国产电影得到了世界的各国的认可和世界各国人民的喜爱。国产电影在的票房市场也越创新高,战狼2一部影片的票房市场就达到56亿,流浪地球票房达到46亿,红海行动36亿票房。越来越多的选择业余走开电影院观看一场电影,电影已经成为他们生活中不可缺少的一部分。
进入新世纪以来,移动互联网技术迅速发展,人们通过手机点点就购买各大电影院的电影票,而且可以进行在线选座,非常的方便快捷,省去了排队等待的时间。随着5G技术的发展,网速进进一步提高,将会有越来越多的通过手机来进行电影票的购买,电影票的在线选座。
功能要点
电影购票系统,系统存在两类用户:普通用户,系统管理员。
1普通用户注册成为系统的合法用户后,可以在线购票电影票,并且选座位。购票支付成功后,可以进行取票操作,当发现和自己的行程存在冲突的时候,用户也可以在网上上发起退票操作。
2 系统管理员主要负责系统的维护,在后台中能对用户信息,影片信息,场次信息进行增删改查
实现效果
![](https://img-blog.csdnimg.cn/img_convert/6eee6947d80f9445d4a6cd57e27d692b.png)
![](https://img-blog.csdnimg.cn/img_convert/c7cdfb5dfb556df8a4016bb522efd246.png)
![](https://img-blog.csdnimg.cn/img_convert/ae6d03b56080da298c897789370575f6.png)
![](https://img-blog.csdnimg.cn/img_convert/f8af704da81e96cfda1fdafb21247de8.png)
![](https://img-blog.csdnimg.cn/img_convert/1101662f221d51ae36b5bfb4318c0e38.png)
![](https://img-blog.csdnimg.cn/img_convert/21298e5711bd7507d3b1d1ece326700f.png)
![](https://img-blog.csdnimg.cn/img_convert/cdad7b72cc153a77c06acf25b8c1d23f.png)
![](https://img-blog.csdnimg.cn/img_convert/a4dbf0b0499ed088e0cb5005580fb51c.png)
![](https://img-blog.csdnimg.cn/img_convert/3f56d38ec91bc5af6ae8c1f7e174baec.png)
![](https://img-blog.csdnimg.cn/img_convert/f6e86b7c5ceb187e3704708704f06617.png)
![](https://img-blog.csdnimg.cn/img_convert/5e30401df8bf9aa5fb91f5d0947e0fc4.png)
![](https://img-blog.csdnimg.cn/img_convert/a70d50c698c5ed7d0001113cffc2ee05.png)
关键代码
package view;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import entity.User;
import service.UserService;
import serviceimpl.UserServiceImpl;
class Login implements ActionListener {
private JFrame jf = new JFrame("电影系统");
private Container con = jf.getContentPane();// 获得面板
private Toolkit toolkit = Toolkit.getDefaultToolkit();
private Dimension sc = toolkit.getScreenSize();// 获得屏幕尺寸
private JLabel title = new JLabel("欢迎使用电影购票系统");
private JLabel name1 = new JLabel("用户名");
private JLabel pass1 = new JLabel("密 码");
private JTextField textName = new JTextField();
private JPasswordField textPs = new JPasswordField();// 密码框
private JRadioButton choice1 = new JRadioButton("用户");
private JRadioButton choice2 = new JRadioButton("管理员");
private JLabel code1 = new JLabel("验证码");
private JTextField textCode = new JTextField();
private JLabel code2 = new JLabel();
private JButton btn_login = new JButton("登录");
private JButton btn_rgist = new JButton("注册");
// 按钮
private Font font = new Font("楷体", 1, 28);
private Font font1 = new Font("楷体", 0, 20);
private Font font2 = new Font("楷体", 0, 18);
// 字体,样式(粗体,斜体),大小
private ButtonGroup buttongroup = new ButtonGroup();
private ImageIcon loginbg = new ImageIcon("image/loginbg.jpg");
public Login() {
con.setLayout(null);
jf.setSize(1000, 618);
jf.setLocation((sc.width - 1000) / 2, (sc.height - 618) / 2);
jf.setResizable(false);// 窗口大小不可变
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
con.setVisible(true);
JLabel maxlabel = new JLabel(loginbg);
title.setBounds(375, 10, 370, 30);
title.setFont(font);
title.setForeground(Color.black);
name1.setBounds(140, 140, 85, 30);// 账号的位置大小
name1.setFont(font1);// 字体
name1.setForeground(Color.black);// name1字的颜色
pass1.setBounds(140, 190, 85, 30);// 密码的位置大小
pass1.setForeground(Color.black);
pass1.setFont(font1);
textName.setBounds(200, 143, 140, 25);
textName.setBorder(null);// 边框
textName.setFont(font1);
textPs.setBounds(200, 193, 140, 25);
textPs.setBorder(null);
textPs.setEchoChar('*');// 可以将密码显示为* ;默认为·
textPs.setFont(font1);
choice1.setBounds(140, 290, 120, 25);
choice1.setSelected(true);// 默认普通用户登录
choice2.setBounds(260, 290, 80, 25);
code1.setBounds(140, 240, 60, 25);
code1.setFont(font1);
code1.setForeground(Color.black);
textCode.setBounds(200, 240, 95, 25);
textCode.setBorder(null);
textCode.setFont(font1);
code2.setBounds(300, 240, 70, 25);
code2.setFont(font1);
code2.setText(code());
code2.setForeground(Color.black);
btn_login.setBounds(140, 340, 90, 25);//140, 340, 90, 25
btn_login.setFont(font2);
btn_login.addActionListener(this);
jf.getRootPane().setDefaultButton(btn_login);//回车默认是登录按钮
btn_rgist.setBounds(250, 340, 90, 25);//250, 340, 90, 25
btn_rgist.setFont(font2);
btn_rgist.addActionListener(this);
JLabel bg = new JLabel(loginbg);
maxlabel.add(title);
maxlabel.add(name1);
maxlabel.add(pass1);
maxlabel.add(textName);
maxlabel.add(textPs);
maxlabel.add(choice1);
maxlabel.add(choice2);
buttongroup.add(choice1);
buttongroup.add(choice2);
maxlabel.add(code1);
maxlabel.add(code2);
maxlabel.add(textCode);
maxlabel.add(btn_login);
maxlabel.add(btn_rgist);
maxlabel.setBounds(0, 0, 999, 617);
con.add(maxlabel);
}
private String code() {
int m = 0;
for (int i = 0; i < 4; i++) {
m *= 10;
m += (int) (Math.random() * 9 + 1);
}
return ((Integer) m).toString();
}
public void cleanUserInfo() {
this.textName.setText("");
this.textPs.setText("");
this.textCode.setText("");
}
public static void winMessage(String str) {// 提示窗口,有多个地方调用
JOptionPane.showMessageDialog(null, str, "提示",
JOptionPane.INFORMATION_MESSAGE);
}
@Override
public void actionPerformed(ActionEvent ac) {
if (ac.getSource() == this.btn_login) {
String name = textName.getText();
String pswd = new String(textPs.getPassword());
if (name.equals("") || pswd.equals("")) {
winMessage("账号、密码不能为空!");
cleanUserInfo();
this.code2.setText(code());
} else {
String code1 = textCode.getText();
String code = code2.getText();
if(code1.equals("")){
winMessage("验证码不能为空!");
return;
}
if (code1.equals(code)) {
int choice;
if (choice1.isSelected())
choice = 0;
else
choice = 1;
UserService userBiz = new UserServiceImpl();
User user = userBiz.login(name, pswd, choice);
if (user == null) {
winMessage("用户名或密码不正确!登录失败!");
cleanUserInfo();
this.code2.setText(code());
} else {
if (user.getType() == 0) {
new UserUi(user,1);
} else if (user.getType() == 1) {
new AdminMainView(user);
}
this.jf.dispose();
}
} else {
winMessage("验证码不正确!");
textCode.setText("");
this.code2.setText(code());
}
}
} else if (ac.getSource() == this.btn_rgist) {
new RegisterUi();
this.jf.dispose();// 点击按钮时,new一个frame,原先frame销毁
}
}
}