package view;
public class NewTicketWindow extends JDialog
/*public static void main(String[] args) {
try {
NewTicketWindow dialog = new NewTicketWindow();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}*/
/**
* Create the dialog.
*/
public NewTicketWindow(Database database)
{
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.database = database;
this.mc = mc;
setBounds(100, 100, 609, 571);
getContentPane().setLayout(null);
contentPanel.setBounds(0, 0, 593, 533);
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel);
contentPanel.setLayout(null);
JLabel lblEnterYourName = new JLabel("Enter your Name:");
lblEnterYourName.setBounds(10, 11, 106, 14);
contentPanel.add(lblEnterYourName);
JLabel lblEnterYourCpf = new JLabel("Enter your CPF:");
lblEnterYourCpf.setBounds(10, 39, 106, 14);
contentPanel.add(lblEnterYourCpf);
JLabel lblSelectAMovie = new JLabel("Select a Movie");
lblSelectAMovie.setBounds(10, 64, 106, 14);
contentPanel.add(lblSelectAMovie);
textField = new JTextField();
textField.setBounds(116, 8, 86, 20);
contentPanel.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setBounds(116, 36, 86, 20);
contentPanel.add(textField_1);
textField_1.setColumns(10);
this.moviesComboBox = new JComboBox();
moviesComboBox.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
moviesComboBoxEvent(evt);
}
});
this.moviesComboBox.setBounds(116, 61, 204, 20);
populateMoviesComboBox();
contentPanel.add(this.moviesComboBox);
JLabel lblDateShowtime = new JLabel("Date & Showtime");
lblDateShowtime.setFont(new Font("Tahoma", Font.PLAIN, 15));
lblDateShowtime.setForeground(Color.BLUE);
lblDateShowtime.setBounds(10, 89, 113, 14);
contentPanel.add(lblDateShowtime);
JSeparator separator = new JSeparator();
separator.setBounds(126, 101, 130, 2);
contentPanel.add(separator);
JLabel lblShowdate = new JLabel("Showdate :");
lblShowdate.setBounds(10, 114, 71, 14);
contentPanel.add(lblShowdate);
JLabel lblShowtime = new JLabel("Showtime :");
lblShowtime.setBounds(10, 139, 71, 14);
contentPanel.add(lblShowtime);
this.showdateComboBox = new JComboBox();
showdateComboBox.setFont(new Font("Tahoma", Font.BOLD, 9));
this.showdateComboBox.setBounds(116, 114, 100, 20);
populateShowdateComboBox();
contentPanel.add(this.showdateComboBox);
this.showtimeComboBox = new JComboBox();
this.showtimeComboBox.setBounds(116, 139, 100, 20);
populateShowtimeComboBox();
contentPanel.add(this.showtimeComboBox);
JLabel label = new JLabel("");
label.setBounds(0, 164, 46, 14);
contentPanel.add(label);
JLabel lblNumberOfTickets = new JLabel("Number of Tickets");
lblNumberOfTickets.setForeground(Color.BLUE);
lblNumberOfTickets.setFont(new Font("Tahoma", Font.PLAIN, 15));
lblNumberOfTickets.setBounds(10, 169, 123, 20);
contentPanel.add(lblNumberOfTickets);
JLabel lblAdults = new JLabel("Adults :");
lblAdults.setBounds(10, 200, 46, 14);
contentPanel.add(lblAdults);
this.adultsComboBox = new JComboBox();
this.adultsComboBox.setBounds(53, 197, 46, 20);
populateAdultsComboBox();
contentPanel.add(this.adultsComboBox);
JLabel lblKids = new JLabel("Kids :");
lblKids.setBounds(10, 225, 46, 14);
contentPanel.add(lblKids);
this.kidsComboBox = new JComboBox();
this.kidsComboBox.setBounds(53, 224, 46, 20);
populateKidsComboBox();
contentPanel.add(this.kidsComboBox);
lblPosterLabel = new JLabel("New label");
lblPosterLabel.setIcon(new ImageIcon("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\equilibrium.jpg"));
lblPosterLabel.setBounds(391, 11, 192, 283);
contentPanel.add(lblPosterLabel);
{
JPanel buttonPane = new JPanel();
buttonPane.setBounds(159, 500, 434, 33);
contentPanel.add(buttonPane);
buttonPane.setLayout(null);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
}
});
okButton.setBounds(273, 5, 65, 23);
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
cancelButton.setBounds(345, 5, 84, 23);
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
setVisible(true);
}
public void populateMoviesComboBox()
{
this.moviesComboBox.removeAllItems();
this.moviesComboBox.addItem("");
for (int i = 0; i < database.getMovie().size(); i++)
{
this.moviesComboBox.addItem(database.getMovie().get(i).getMovieTitle());
}
}
public void populateShowtimeComboBox()
{
this.showtimeComboBox.removeAllItems();
this.showtimeComboBox.addItem("");
for(int i = 0; i < database.getShowtime().size(); i++)
{
this.showtimeComboBox.addItem(database.getShowtime().get(i).getShowtime());
}
}
public void populateShowdateComboBox()
{
this.showdateComboBox.removeAllItems();
this.showdateComboBox.addItem("");
for(int i = 0; i < database.getShowdate().size(); i++)
{
this.showdateComboBox.addItem(database.getShowdate().get(i).getShowdate());
}
}
public void populateAdultsComboBox()
{
this.adultsComboBox.removeAllItems();
this.adultsComboBox.addItem("");
for(int i = 0; i < database.getAdultsKids().size(); i++)
{
this.adultsComboBox.addItem(database.getAdultsKids().get(i).getNumberOfAdultsAndKids());
}
}
public void populateKidsComboBox()
{
this.kidsComboBox.removeAllItems();
this.kidsComboBox.addItem("");
for(int i = 0; i < database.getAdultsKids().size(); i++)
{
this.kidsComboBox.addItem(database.getAdultsKids().get(i).getNumberOfAdultsAndKids());
}
}
private void cancelPressed()
{
System.exit(DISPOSE_ON_CLOSE);
}
public void moviesComboBoxEvent(java.awt.event.ActionEvent evt)
{
if((String)moviesComboBox.getSelectedItem() == "Equilibrium")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\equilibrium.jpg")));
}
else if((String)moviesComboBox.getSelectedItem() == "Mad Max: Fury Road")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\madmax.jpg")));
}
else if((String)moviesComboBox.getSelectedItem() == "Rosemary's Baby")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\rosemary.jpg")));
}
else if((String)moviesComboBox.getSelectedItem() == "Alien")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\alien.jpg")));
}
else if((String)moviesComboBox.getSelectedItem() == "The Matrix")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\matrix.jpg")));
}
else if((String)moviesComboBox.getSelectedItem() == "Furious 7")
{
lblPosterLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:\\Users\\Roberto\\workspace\\ProjetoFinaldeCurso\\moviePosters\\furious.jpg")));
}
}
private void moviesComboBoxItemStateChanged(java.awt.event.ItemEvent e)
{
}
}