public TicketingSystem()
{
setSize(500,400);
setTitle(" Roxy Theatres Online Ticketing System ");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// set layout for main frame
setLayout(new BorderLayout());
//Top Panel
JPanel ptop = new JPanel();
ptop.setLayout(new GridLayout(2,1));
Font f = new Font("Helvetica", Font.BOLD, 24);
lblTitle = new JLabel("Roxy Theatres - Online Ticketing System");
lblTitle.setFont(f);
lblTitle.setForeground(Color.GREEN);
ptop.add(lblTitle);
lblRsv = new JLabel(" Reserve seats by clicking on them! ");
ptop.add(lblRsv);
//button Panel
JPanel btnPanel = new JPanel();
btnPanel.setLayout(new GridLayout(3,5));
jbtn1 = new JButton("1");
jbtn1.setBackground(Color.BLUE);
jbtn1.addActionListener(new colorHandler());
jbtn2 = new JButton("2");
jbtn2.setBackground(Color.BLUE);
jbtn2.addActionListener(new colorHandler());
jbtn3 = new JButton("3");
jbtn3.setBackground(Color.BLUE);
jbtn3.addActionListener(new colorHandler());
jbtn4 = new JButton("4");
jbtn4.setBackground(Color.BLUE);
jbtn4.addActionListener(new colorHandler());
jbtn5 = new JButton("5");
jbtn5.setBackground(Color.BLUE);
jbtn5.addActionListener(new colorHandler());
jbtn6 = new JButton("6");
jbtn6.setBackground(Color.BLUE);
jbtn6.addActionListener(new colorHandler());
jbtn7 = new JButton("7");
jbtn7.setBackground(Color.BLUE);
jbtn7.addActionListener(new colorHandler());
jbtn8 = new JButton("8");
jbtn8.setBackground(Color.BLUE);
jbtn8.addActionListener(new colorHandler());
jbtn9 = new JButton("9");
jbtn9.setBackground(Color.BLUE);
jbtn9.addActionListener(new colorHandler());
jbtn10 = new JButton("10");
jbtn10.setBackground(Color.BLUE);
jbtn10.addActionListener(new colorHandler());
jbtn11 = new JButton("11");
jbtn11.setBackground(Color.BLUE);
jbtn11.addActionListener(new colorHandler());
jbtn12 = new JButton("12");
jbtn12.setBackground(Color.BLUE);
jbtn12.addActionListener(new colorHandler());
jbtn13 = new JButton("13");
jbtn13.setBackground(Color.BLUE);
jbtn13.addActionListener(new colorHandler());
jbtn14 = new JButton("14");
jbtn14.setBackground(Color.BLUE);
jbtn14.addActionListener(new colorHandler());
jbtn15 = new JButton("15");
jbtn15.setBackground(Color.BLUE);
jbtn15.addActionListener(new colorHandler());
//Panel 3
JPanel p3 = new JPanel();
p3.setLayout(new GridLayout(5,1));
lblSeat = new JLabel("Seats :");
lblAva = new JLabel("Available BLUE ");
lblAva.setForeground(Color.blue);
lblRes = new JLabel("Reseved RED ");
lblRes.setForeground(Color.red);
lblTic = new JLabel(" Price per ticket: $8.50($8 promo price for 3 or more) ");
lblPref = new JLabel(" Price per refreshment pack(Cok + Popcorn) $5.50 ");
//add label into Panel 3
p3.add(lblSeat);
p3.add(lblAva);
p3.add(lblRes);
p3.add(lblTic);
p3.add(lblPref);
//Panel 4
JPanel p4 = new JPanel();
p4.setLayout(new FlowLayout());
//add button into Panel 4
btnConfirm = new JButton("CONFIRM");
btnConfirm.addActionListener(new ConfirmHandler());
btnReset = new JButton("RESET");
btnReset.addActionListener(new ResetHandler());
p4.add(btnConfirm);
p4.add(btnReset);
//Panel 5
JPanel p5 = new JPanel();
p5.setLayout(new GridLayout(2,1));
lblRef = new JLabel(" How many refreshment packs? ");
tfRef = new JTextField(20);
//add label into Panel 5
p5.add(lblRef);
p5.add(tfRef);
//Panel 6
JPanel p6 = new JPanel();
p6.setLayout(new FlowLayout());
movieList = new JComboBox(strMovie);
lblMov = new JLabel("MovieList", JLabel.LEFT);
p6.add(lblMov);
p6.add(movieList);
//Panel 7
JPanel p7 = new JPanel();
p7.setLayout(new FlowLayout());
timeList = new JComboBox(strTime);
lblTime = new JLabel("TimeList", JLabel.LEFT);
p7.add(lblTime);
p7.add(timeList);
//Panel 8
JPanel p8 = new JPanel();
p8.setLayout(new FlowLayout());
dateList = new JComboBox(strDate);
lblDate = new JLabel("DateList", JLabel.LEFT);
p8.add(lblDate);
p8.add(dateList);
//Panel Left
JPanel pleft = new JPanel();
pleft.setLayout(new GridLayout(3,1));
pleft.add(p6);
pleft.add(p7);
pleft.add(p8);
if (jbtn1.getBackground()==Color.RED){
seat = seatNo[1];
ticketCount++;
}
else if (jbtn2.getBackground()==Color.RED){
seat = seatNo[2];
ticketCount++;
}
else if (jbtn3.getBackground()==Color.RED){
seat = seatNo[3];
ticketCount++;
}
else if (jbtn4.getBackground()==Color.RED){
seat = seatNo[4];
ticketCount++;
}
else if (jbtn5.getBackground()==Color.RED){
seat = seatNo[5];
ticketCount++;
}
else if (jbtn6.getBackground()==Color.RED){
seat = seatNo[6];
ticketCount++;
}
else if (jbtn7.getBackground()==Color.RED){
seat = seatNo[7];
ticketCount++;
}
else if (jbtn8.getBackground()==Color.RED){
seat = seatNo[8];
ticketCount++;
}
else if (jbtn9.getBackground()==Color.RED){
seat = seatNo[9];
ticketCount++;
}
else if (jbtn10.getBackground()==Color.RED){
seat = seatNo[10];
ticketCount++;
}
else if (jbtn11.getBackground()==Color.RED){
seat = seatNo[11];
ticketCount++;
}
else if (jbtn12.getBackground()==Color.RED){
seat = seatNo[12];
ticketCount++;
}
else if (jbtn13.getBackground()==Color.RED){
seat = seatNo[13];
ticketCount++;
}
else if (jbtn14.getBackground()==Color.RED){
seat = seatNo[14];
ticketCount++;
}
else if (jbtn15.getBackground()==Color.RED){
seat = seatNo[15];
ticketCount++;
}
}
//Number of seats reserved
int displaySeats = 0;
for(int a=0; a<seat.length; a++)
{
int a = seat;
int b = Integer.parseInt(seat[a]);
displaySeats = a;
}
String confirmationMsg = "Movie:" +movie+ "\nTime:" +time+" \nDate:" +date+
"\nNumber of seats reserved is "+displaySeats+ "\nCost of " +no+ " refreshment packs is"+cost+;