package com.zyp.view;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Vector;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import com.zyp.entity.Cinema;
import com.zyp.entity.Comment;
import com.zyp.entity.Hall;
import com.zyp.entity.Movie;
import com.zyp.entity.Session;
import com.zyp.entity.Ticket;
import com.zyp.entity.User;
import com.zyp.service.CinemaService;
import com.zyp.service.CommentService;
import com.zyp.service.HallService;
import com.zyp.service.MovieService;
import com.zyp.service.SessionService;
import com.zyp.service.TicketService;
import com.zyp.service.UserService;
import com.zyp.service.impl.CinemaServiceImpl;
import com.zyp.service.impl.CommentServiceImpl;
import com.zyp.service.impl.HallServiceImpl;
import com.zyp.service.impl.MovieServiceImpl;
import com.zyp.service.impl.SessionServiceImpl;
import com.zyp.service.impl.TicketServiceImpl;
import com.zyp.service.impl.UserServiceImpl;
public class UserUi implements ActionListener {
private User user;
private UserService uo=new UserServiceImpl();
private MovieService mo = new MovieServiceImpl();
private TicketService ticketservice=new TicketServiceImpl();
private CommentService commentservice=new CommentServiceImpl();
private CinemaService cinemaservice=new CinemaServiceImpl();
private SessionService sessionservice=new SessionServiceImpl();
private HallService hallservice=new HallServiceImpl();
private int size=0;
private int size1=0;
private int size2=0;
private int size3=0;
private int size4=0;
private int row = -1;// 行
private int row1=-1;
private int defaultcard;
private Comment ccomment;
private JLabel card0 = new JLabel();//用户
private JLabel card8 = new JLabel();//我的影票
private JLabel card1 = new JLabel();//热门
private JLabel card2 = new JLabel();//查找
private JLabel card3 = new JLabel();//科幻
private JLabel card4 = new JLabel();//动作
private JLabel card5 = new JLabel();//爱情
/*private JLabel card6 = new JLabel();//剧情
private JLabel card7 = new JLabel();//动漫
*/ private JFrame jf = new JFrame("电影购票系统");
private JMenuBar menuBar = new JMenuBar();
private Container con = jf.getContentPane();// 获得面板
private JPasswordField oldpass = new JPasswordField();
private JPasswordField newpass = new JPasswordField();
private JButton jupdatere=new JButton("更改评论");
private JButton jreport=new JButton("发表");
private JButton reFresh = new JButton("刷新");
private JButton btnexit = new JButton("退出");//
private JButton updatepass = new JButton("修改密码");
private JButton confirmUp = new JButton("确定");
private JButton cancel = new JButton("取消");
private JLabel oldjl;
private JLabel newjl;
private JTable ticktb;
private JTable movietb;
private ImageIcon userinfobg = new ImageIcon("images/userinfobg.jpg");
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 Toolkit toolkit = Toolkit.getDefaultToolkit();
private Dimension sc = toolkit.getScreenSize();// 获得屏幕尺寸
private JLabel jIscomment=new JLabel();//是否评论
private JTextArea jcommentcontent=new JTextArea(30,30);//评论内容
private JLabel moviebtn_label;
private JButton moviecard1_btn;
private JButton delTicket;
private JLabel moviename;
private JLabel movielocality_language;
private JLabel movietype_grade;
private JTextField jsearch_nametext=new JTextField();
private JButton jsearch_jbutton=new JButton("搜索电影");
//评分前十
private JLabel[][] btn_label;
private JButton[] card1_btn;
private JLabel[][] dname;
private JLabel[][] locality_language;
private JLabel[][] type_grade;
//科幻部分
private JLabel[][] btn_label1;
private JButton[] card1_btn1;
private JLabel[][] dname1;
private JLabel[][] locality_language1;
private JLabel[][] type_grade1;
//动作部分
private JLabel[][] btn_label2;
private JButton[] card1_btn2;
private JLabel[][] dname2;
private JLabel[][] locality_language2;
private JLabel[][] type_grade2;
//爱情部分
private JLabel[][] btn_label3;
private JButton[] card1_btn3;
private JLabel[][] dname3;
private JLabel[][] locality_language3;
private JLabel[][] type_grade3;
private List<Ticket> ticketlist;
private List<Movie> movielist;
private List<Movie> list;
private List<Movie> sciencelist;
private List<Movie> actionlist;
private List<Movie> lovelist;
private JButton isrecharge;//选择充值按钮
private JLabel rechargeinfo;//提示
private JButton recharge;//充值按钮
private JTextField charge;//输入
private JLabel[] card0_label = new JLabel[2];
public UserUi(User u, int defaultcard) {
user = u;
this.defaultcard = defaultcard;
jf.setExtendedState(JFrame.MAXIMIZED_BOTH);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);// 点击栏位置
// 选项卡面板类
reFresh.addActionListener(this);
reFresh.setFont(font1);
btnexit.addActionListener(this);
btnexit.setFont(font1);
jf.setJMenuBar(menuBar);
menuBar.add(reFresh);
menuBar.add(btnexit);
tabbedPane.setFont(font);// 左栏字体,字号
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);// 每个选项卡滚动模式
con.add(tabbedPane);
// 用户信息
tabbedPane.addTab("欢迎您," + user.getuName(), card0);
JLabel maxlabel = new JLabel();
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), 500, 50);
}
card0_label[0].setText("您的信息如下: ");
card0_label[0].setForeground(Color.gray);
card0_label[1].setText("用户名 : " + user.getuName()+"余额:"+user.getBalance()+"元");
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);
isrecharge=new JButton("充值金额");
isrecharge.setBounds(200, 190, 120, 35);
isrecharge.addActionListener(this);
isrecharge.setFont(font);
isrecharge.setForeground(Color.white);
isrecharge.setBackground(Color.gray);
maxlabel.add(isrecharge);
rechargeinfo=new JLabel("请输入金额");
rechargeinfo.setBounds(200, 250, 120, 30);
rechargeinfo.setFont(font);
rechargeinfo.setForeground(Color.LIGHT_GRAY);
rechargeinfo.setVisible(false);
maxlabel.add(rechargeinfo);
charge=new JTextField();
charge.setBounds(200, 300, 120, 30);
charge.setBackground(Color.GRAY);
charge.setFont(font);
charge.setForeground(Color.white);
charge.setFont(font);
charge.setVisible(false);
maxlabel.add(charge);
recharge=new JButton("充值");
recharge.setBounds(200, 380, 120, 30);
recharge.setForeground(Color.white);
recharge.setBackground(Color.GRAY);
recharge.setFont(font);
评论1