package view;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;
import javax.swing.*;
import javax.swing.event.TableModelListener;
import javax.swing.table.TableModel;
import entity.Hall;
import entity.Movie;
import entity.Session;
import entity.Ticket;
import entity.User;
import service.CinemaService;
import service.HallService;
import service.MovieService;
import service.SessionService;
import service.TicketService;
import service.UserService;
import serviceimpl.CinemaServiceImpl;
import serviceimpl.HallServiceImpl;
import serviceimpl.MovieServiceImpl;
import serviceimpl.SessionServiceImpl;
import serviceimpl.TicketServiceImpl;
import serviceimpl.UserServiceImpl;
public class UserUi implements ActionListener ,Runnable{
private SessionService session = null;
private MovieService ms = null;
private CinemaService cs = null;
private HallService hs = null;
TicketService ts = null;
private UserService us = null;
private User user;
private int defaultcard;
private JFrame jf = new JFrame("电影购票系统");
private Container con = jf.getContentPane();// 获得面板
private Toolkit toolkit = Toolkit.getDefaultToolkit();
private Dimension sc = toolkit.getScreenSize();// 获得屏幕尺寸
private JLabel lb_welcome = null;
JTable rtb = null;
JTable rtb2 = null;
private JButton btn_buy = null;
private JButton btn_comment = new JButton("评价");
private JButton btnsearch = new JButton("搜索影片");
private JButton btn_balance = new JButton("充值/余额查询");
private JMenuBar menuBar = new JMenuBar();
private JLabel oldjl;
private JLabel newjl;
private JLabel card0 = new JLabel();
private JButton updatepass = new JButton("修改用户信息");
private JButton confirmUp = new JButton("确定");
private JButton cancel = new JButton("取消");
private JPasswordField oldpass = new JPasswordField();
private JPasswordField newpass = new JPasswordField();
private JLabel card1 = new JLabel();
private JLabel card2 = new JLabel();
private JLabel card3 = new JLabel();
private JLabel card4 = new JLabel();
private Font font = new Font("楷体", 0, 20);
private Font font0 = new Font("楷体", 0, 25);
private Font font1 = new Font("楷体", 0, 16);
private Font font2 = new Font("楷体", 0, 15);
private ImageIcon userinfobg = new ImageIcon("image/userinfo.jpg");
private JTable tb = null;
JButton[] card1_btn = null;
int x = 0;
int k = 0;
List<Movie> mlist = null;
List<Session> sessionlist = null;
List<Ticket> ticketByUId = null;
// 开启线程使得欢迎标签动起来
// 这是单线程
private class thread implements Runnable {
@Override
public void run() {
while (true) {// 死循环让其一直移动
for (int i = 900; i > -700; i--) {
// for(int i=-100;i<900;i++){
try {
Thread.sleep(10);// 让线程休眠100毫秒
} catch (InterruptedException e) {
e.printStackTrace();
}
lb_welcome.setLocation(i, 5);
}
}
}
}
public UserUi(User user) {
super();
this.user = user;
session = new SessionServiceImpl();
ms = new MovieServiceImpl();
cs = new CinemaServiceImpl();
hs = new HallServiceImpl();
ts = new TicketServiceImpl();
us = new UserServiceImpl();
showTicketTable(ticketByUId);
showSessionTable(sessionlist);
}
public UserUi(User u, int defaultcard) {
user = u;
this.defaultcard = defaultcard;
session = new SessionServiceImpl();
ms = new MovieServiceImpl();
cs = new CinemaServiceImpl();
hs = new HallServiceImpl();
ts = new TicketServiceImpl();
us = new UserServiceImpl();
mlist = ms.getAllMovielist();
sessionlist = session.queryAllSession();
//showTicketTable(ticketByUId);
// showSessionTable(sessionlist);
// 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);
btn_buy = new JButton("购买");
btn_buy.setEnabled(false);
btn_buy.addActionListener(this);
btn_buy.setFont(font1);
btn_comment.addActionListener(this);
btn_comment.setFont(font1);
btn_comment.setEnabled(false);
btn_balance.addActionListener(this);
btn_balance.setFont(font1);
btnsearch.setBounds(300, 0, 150, 30);
btnsearch.setFont(font1);
btnsearch.addActionListener(this);
lb_welcome = new JLabel("欢 迎 " + u.getUname() + " 进 入 用 户 功 能 界 面");
lb_welcome.setFont(new Font("楷体", Font.BOLD, 34));
lb_welcome.setForeground(Color.BLUE);
jf.setJMenuBar(menuBar);
menuBar.add(btn_buy);
menuBar.add(btn_balance);
menuBar.add(btnsearch);
menuBar.add(btn_comment);
menuBar.add(lb_welcome);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.RIGHT);// 点击栏位置
// 选项卡面板类
tabbedPane.setFont(font);// 选项栏栏字体,字号
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);// 每个选项卡滚动模式
con.add(tabbedPane);
// tabbedPane.setSelectedIndex(0); // 设置默认选中的card
// card0 user.getUname()
tabbedPane.addTab(u.getUname()+" 欢迎您", card0);
JLabel maxlabel = new JLabel();
JLabel[] card0_label = new JLabel[2];
for (int i = 0; i < 2; i++) {
card0_label[i] = new JLabel();
maxlabel.add(card0_label[i]);
card0_label[i].setFont(font0);
card0_label[i].setBounds(40, 70 + (i * 50), 250, 50);
}
card0_label[0].setText("您的信息如下: ");
card0_label[0].setForeground(Color.gray);
card0_label[1].setText("用户名 : " + u.getUname());// user.getUname()
card0_label[1].setForeground(Color.gray);
updatepass.setBounds(40, 190, 120, 35);
updatepass.addActionListener(this);
updatepass.setBackground(Color.gray);
updatepass.setFont(font);
updatepass.setForeground(Color.white);
maxlabel.add(updatepass);
oldjl = new JLabel("原密码");
oldjl.setBounds(40, 250, 90, 30);
oldjl.setForeground(Color.LIGHT_GRAY);
oldjl.setFont(font);
oldjl.setVisible(false);
maxlabel.add(oldjl);
oldpass.setBounds(40, 280, 120, 30);
oldpass.setBackground(Color.GRAY);
oldpass.setFont(font);
oldpass.setForeground(Color.white);
oldpass.setEchoChar('*');
oldpass.setVisible(false);
maxlabel.add(oldpass);
newjl = new JLabel("新密码");
newjl.setBounds(40, 350, 90, 30);
newjl.setFont(font);
newjl.setForeground(Color.LIGHT_GRAY);
newjl.setVisible(false);
maxlabel.add(newjl);
newpass.setBounds(40, 380, 120, 30);
newpass.setBackground(Color.GRAY);
newpass.setForeground(Color.white);
newpass.setFont(font);
newpass.setEchoChar('*');
newpass.setVisible(false);
maxlabel.add(newpass);
cancel.setBounds(40, 500, 120, 30);
maxlabel.add(cancel);
cancel.setBackground(Color.GRAY);
cancel.setForeground(Color.white);
cancel.setFont(font);
cancel.setVisible(false);
cancel.addActionListener(this);
confirmUp.setBounds(40, 445, 120, 30);
confirmUp.setBackground(Color.GRAY);
confirmUp.setForeground(Color.white);
confirmUp.setFont(font);
maxlabel.add(confirmUp);
confirmUp.setVisible(false);
confirmUp.addActionListener(this);
maxlabel.setIcon(userinfobg);
maxlabel.setBounds(0, 0, 850, 602);
card0.add(maxlabel);
// card1
tabbedPane.addTab("碟片排行榜", card1);
movieShow(mlist);
// card3
tabbedPane.addTab("购票信息", card3);
ticketByUId = ts.queryTicketByUserId(user.getUser_id());
showTicketTable(ticketByUId);
// card2未还记录
tabbedPane.addTab("场次信息", card2);
没有合适的资源?快使用搜索试试~ 我知道了~
java swing实电影购票管理系统
共201个文件
class:106个
java:58个
jpg:26个
需积分: 37 85 下载量 55 浏览量
2018-08-03
14:55:39
上传
评论 23
收藏 4.32MB RAR 举报
温馨提示
首先系统分为前台用户登录注册和后台管理员进行管理 项目采用三层架构思想 ,展示功能全部实现。是javaSE学习的好资源,
资源推荐
资源详情
资源评论
收起资源包目录
java swing实电影购票管理系统 (201个子文件)
UserUi.class 16KB
MovieInfoView.class 8KB
operSessionView.class 7KB
Login.class 6KB
ZuoWeiFrame.class 6KB
operMovieView.class 6KB
RegisterUi.class 5KB
CommentView.class 5KB
operHallView.class 5KB
operCinemaView.class 5KB
AdminMainView.class 5KB
operUserView.class 5KB
BaseDao.class 4KB
UserDaoImpl.class 4KB
SearchMovieUi.class 4KB
operSessionView$SessionInfoTableModel.class 4KB
MovieDaoImpl.class 4KB
operSessionView$3.class 4KB
SessionDaoImpl.class 3KB
CommentDaoImpl.class 3KB
operHallView$HallInfoTableModel.class 3KB
CinemaDaoImpl.class 3KB
operMovieView$MovieInfoTableModel.class 3KB
HallDaoImpl.class 3KB
operUserView$UserInfoTableModel.class 3KB
operMovieView$4.class 3KB
ChargeView.class 2KB
operHallView$2.class 2KB
Session.class 2KB
operHallView$4.class 2KB
operCinemaView$CinemaInfoTableModel.class 2KB
User.class 2KB
TicketDaoImpl.class 2KB
Movie.class 2KB
Comment.class 2KB
operCinemaView$4.class 2KB
ChargeView$1.class 2KB
operUserView$4.class 2KB
operMovieView$3.class 2KB
Ticket.class 2KB
operSessionView$4.class 2KB
UserDaoTest.class 2KB
operMovieView$5.class 2KB
operUserView$3.class 2KB
UserServiceImpl.class 2KB
MovieInfoView$1.class 2KB
CommentView$1.class 2KB
operSessionView$1.class 2KB
Hall.class 2KB
operCinemaView$5.class 2KB
CommentDaoTest.class 2KB
operCinemaView$3.class 1KB
operMovieView$1.class 1KB
operHallView$1.class 1KB
Cinema.class 1KB
operCinemaView$1.class 1KB
SessionServiceImpl.class 1KB
CommentServiceImpl.class 1KB
TicketServiceImpl.class 1KB
MovieServiceImpl.class 1KB
CinemaServiceImpl.class 1KB
MovieDaoTest.class 1KB
HallServiceImpl.class 1KB
operSessionView$2.class 1KB
operHallView$3.class 1KB
AdminMainView$thread.class 1KB
operCinemaView$2.class 1011B
operMovieView$2.class 1003B
operUserView$2.class 995B
MovieInfoView$3.class 959B
AdminMainView$5.class 952B
AdminMainView$3.class 950B
AdminMainView$6.class 948B
AdminMainView$4.class 946B
AdminMainView$2.class 946B
operUserView$1.class 925B
TicketDaoTest.class 896B
UserUi$thread.class 894B
HallDaoTest.class 877B
UserUi$2.class 859B
UserUi$1.class 858B
AdminMainView$1.class 760B
AdminMainView$7.class 723B
MovieInfoView$2.class 706B
operSessionView$5.class 704B
operCinemaView$6.class 698B
operMovieView$6.class 692B
operUserView$5.class 686B
operHallView$5.class 686B
UserDao.class 657B
SessionDaoTest.class 655B
MovieDao.class 614B
Check.class 591B
UserService.class 577B
SessionService.class 484B
CommentService.class 482B
CinemaService.class 472B
SessionDao.class 472B
CommentDao.class 470B
CinemaDao.class 456B
共 201 条
- 1
- 2
- 3
资源评论
冬瓜螺旋雪碧
- 粉丝: 766
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功