0% found this document useful (0 votes)
5 views

Final Code

The document is a Java program for a movie rental application with a graphical user interface (GUI) built using Swing. It includes functionalities for user login and registration, allowing users to select their type (CLIENT or ADMIN) and enter their credentials. The application also features image handling and event listeners for various buttons and components in the GUI.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Final Code

The document is a Java program for a movie rental application with a graphical user interface (GUI) built using Swing. It includes functionalities for user login and registration, allowing users to select their type (CLIENT or ADMIN) and enter their credentials. The application also features image handling and event listeners for various buttons and components in the GUI.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 206

package RentMovie;

import java.sql.*;

import java.time.LocalDate;

import java.time.Period;

import java.time.Year;

import java.util.HashMap;

import java.util.Map;

import javax.swing.*;

import javax.swing.table.DefaultTableModel;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.net.URL;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

public class wewe implements ActionListener {

private JFrame loginFrame;

private JFrame linesFrame;

private static final int IMAGE_WIDTH = 500;

private static final int IMAGE_HEIGHT = 300;

private JLabel imageLabel;

private ImageIcon[] images;

private int currentImageIndex = 0;

private Timer timer;

Connection con = null;


PreparedStatement stmt = null;

ResultSet rs = null;

public static void main(String[] args) {

SwingUtilities.invokeLater(() -> {

wewe app = new wewe();

app.createAndShowGUI();

});

public void createAndShowGUI() {

loginFrame = createLoginFrame(null);

loginFrame.setVisible(true);

private JFrame createLoginFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(540, 466);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

Image img = new ImageIcon(this.getClass().getResource("/image.jpg")).getImage();

Image frontImage = new


ImageIcon(this.getClass().getResource("/cinema123.png")).getImage();

Image frontImage1 = new


ImageIcon(this.getClass().getResource("/logoname.png")).getImage();

JLabel lblSelectUserType = new JLabel("Select User Type:");


lblSelectUserType.setForeground(Color.WHITE);

lblSelectUserType.setFont(new Font("Broadway", Font.BOLD | Font.ITALIC, 15));

lblSelectUserType.setBounds(99, 290, 170, 30);

f.getContentPane().add(lblSelectUserType);

JComboBox<String> comboBox = new JComboBox<>(new String[]{"CLIENT", "ADMIN"});

comboBox.setBounds(324, 290, 103, 30);

f.getContentPane().add(comboBox);

JLabel lblNewLabel = new JLabel("Don't have an account?");

lblNewLabel.setForeground(new Color(255, 255, 255));

lblNewLabel.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 13));

lblNewLabel.setBounds(190, 385, 139, 30);

f.getContentPane().add(lblNewLabel);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.setBounds(334, 380, 82, 40);

f.getContentPane().add(btnSignUp);

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

createRegisterframe(username);

f.dispose();

});

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(10, -24, 367, 165);

f.getContentPane().add(frontLabel);
JLabel frontLabel1 = new JLabel("");

frontLabel1.setBackground(new Color(0, 0, 0));

frontLabel1.setForeground(new Color(0, 0, 0));

frontLabel1.setIcon(new ImageIcon(frontImage1));

frontLabel1.setBounds(10, 100, 526, 132);

f.getContentPane().add(frontLabel1);

JLabel usernameLabel = new JLabel("Username:");

usernameLabel.setBackground(new Color(255, 255, 0));

usernameLabel.setBounds(99, 202, 190, 30);

usernameLabel.setForeground(new Color(255, 255, 255));

usernameLabel.setFont(new Font("Broadway", Font.BOLD, 20));

f.getContentPane().add(usernameLabel);

JTextField usernameField = new JTextField();

usernameField.setBounds(299, 200, 150, 30);

usernameField.setFont(new Font("Arial", Font.PLAIN, 22));

f.getContentPane().add(usernameField);

JLabel passwordLabel = new JLabel("Password:");

passwordLabel.setBounds(99, 250, 150, 30);

passwordLabel.setForeground(new Color(255, 255, 255));

passwordLabel.setFont(new Font("Broadway", Font.BOLD | Font.ITALIC, 20));

f.getContentPane().add(passwordLabel);

JPasswordField passwordField = new JPasswordField();

passwordField.setBounds(299, 250, 150, 30);

passwordField.setFont(new Font("Arial", Font.PLAIN, 22));

f.getContentPane().add(passwordField);
JCheckBox showPassword = new JCheckBox("Show Password");

showPassword.setBounds(460, 250, 21, 31);

showPassword.setForeground(Color.WHITE);

showPassword.setBackground(new Color(255, 255, 255));

f.getContentPane().add(showPassword);

showPassword.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

if (showPassword.isSelected()) {

passwordField.setEchoChar((char) 0);

} else {

passwordField.setEchoChar('*');

});

JButton loginButton = new JButton("LOG IN");

loginButton.setFont(new Font("Tahoma", Font.BOLD, 10));

loginButton.setBounds(334, 330, 82, 40);

f.getContentPane().add(loginButton);

loginButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

String username = usernameField.getText();

String password = new String(passwordField.getPassword());

String userType = (String) comboBox.getSelectedItem();

authenticateUser(username, password, userType, f );

});

JButton cancelButton = new JButton("Quit");

cancelButton.setFont(new Font("Tahoma", Font.BOLD, 15));

cancelButton.setBounds(33, 381, 82, 30);

cancelButton.addActionListener(e -> System.exit(0));

f.getContentPane().add(cancelButton);
JLabel label = new JLabel("");

label.setIcon(new ImageIcon(img));

label.setBounds(-144, -54, 680, 541);

f.getContentPane().add(label);

return f;

private Connection createRegisterframe(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(700, 710);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/image.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblNewLabel_2_3_2_1 = new JLabel("Age");

lblNewLabel_2_3_2_1.setForeground(Color.WHITE);

lblNewLabel_2_3_2_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_3_2_1.setBounds(532, 497, 67, 13);

f.getContentPane().add(lblNewLabel_2_3_2_1);
JTextField userr = new JTextField();

userr.setHorizontalAlignment(SwingConstants.CENTER);

userr.setFont(new Font("Arial", Font.PLAIN, 15));

userr.setBounds(267, 465, 136, 30);

f.getContentPane().add(userr);

JLabel lblNewLabel_2_1_1_1 = new JLabel("Username");

lblNewLabel_2_1_1_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_1_1_1.setForeground(Color.WHITE);

lblNewLabel_2_1_1_1.setBounds(303, 448, 100, 13);

f.getContentPane().add(lblNewLabel_2_1_1_1);

JLabel lblNewLabel_2_1_1_1_1 = new JLabel("Password");

lblNewLabel_2_1_1_1_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_1_1_1_1.setForeground(Color.WHITE);

lblNewLabel_2_1_1_1_1.setBounds(303, 505, 92, 13);

f.getContentPane().add(lblNewLabel_2_1_1_1_1);

JPasswordField passwo = new JPasswordField();

passwo.setBounds(267, 523, 136, 30);

f.getContentPane().add(passwo);

JTextField emailact = new JTextField();

emailact.setHorizontalAlignment(SwingConstants.CENTER);

emailact.setFont(new Font("Arial", Font.PLAIN, 15));

emailact.setBounds(51, 448, 172, 30);

f.getContentPane().add(emailact);

JLabel lblNewLabel_2_3_3 = new JLabel("Email");

lblNewLabel_2_3_3.setForeground(Color.WHITE);

lblNewLabel_2_3_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));


lblNewLabel_2_3_3.setBounds(124, 428, 67, 13);

f.getContentPane().add(lblNewLabel_2_3_3);

JButton cancelButton = new JButton("EXIT");

cancelButton.setBounds(210, 613, 117, 40);

cancelButton.addActionListener(e -> System.exit(0));

f.getContentPane().add(cancelButton);

JLabel lblNewLabel_1 = new JLabel( "<html><div style='text-align: center;'>Ready to Watch?


Enter your Email or Mobile Number and<br>Few Personal information to create or<br> Start you
Membership</div></html>");

lblNewLabel_1.setHorizontalAlignment(SwingConstants.LEFT);

lblNewLabel_1.setFont(new Font("Tahoma", Font.ITALIC, 18));

lblNewLabel_1.setForeground(new Color(255, 255, 255));

lblNewLabel_1.setBounds(107, 265, 461, 77);

f.getContentPane().add(lblNewLabel_1);

JTextField fnameact = new JTextField();

fnameact.setHorizontalAlignment(SwingConstants.CENTER);

fnameact.setFont(new Font("Arial", Font.PLAIN, 15));

fnameact.setBounds(51, 372, 172, 30);

f.getContentPane().add(fnameact);

JTextField mnameact = new JTextField();

mnameact.setHorizontalAlignment(SwingConstants.CENTER);

mnameact.setFont(new Font("Arial", Font.PLAIN, 15));

mnameact.setBounds(253, 372, 174, 30);

f.getContentPane().add(mnameact);

JTextField lnameact = new JTextField();

lnameact.setHorizontalAlignment(SwingConstants.CENTER);

lnameact.setFont(new Font("Arial", Font.PLAIN, 15));


lnameact.setBounds(452, 372, 174, 30);

f.getContentPane().add(lnameact);

JButton btnSignIn = new JButton("<html><div style='text-align: center;'>Already have an


Account?<br>Sign in here ");

btnSignIn.setFont(new Font("Tahoma", Font.BOLD, 7));

btnSignIn.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame loginFrame = createLoginFrame(username);

loginFrame.setVisible(true);

f.dispose();

});

btnSignIn.setBounds(544, 24, 117, 40);

f.getContentPane().add(btnSignIn);

JLabel lblNewLabel = new JLabel("Cinemasaya");

lblNewLabel.setForeground(new Color(255, 255, 255));

lblNewLabel.setFont(new Font("Viner Hand ITC", Font.BOLD, 25));

lblNewLabel.setBounds(10, 24, 181, 54);

f.getContentPane().add(lblNewLabel);

JLabel lblNewLabel_5 = new JLabel( "<html><div style='text-align: center;'>Ready to Watch?


Enter your Email or Mobile Number and<br>Few Personal information to create or<br> Start your
Membership</div></html>");

JLabel lblNewLabel_3 = new JLabel("<html><div style='text-align: center;'>Hi there,


Cinemasaya is offering unlimited movies,<br> TV shows, and more just for you anytime and
anywhere");

lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 21));

lblNewLabel_3.setForeground(new Color(255, 255, 255));

lblNewLabel_3.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel_3.setBounds(51, 124, 572, 131);

f.getContentPane().add(lblNewLabel_3);

JLabel lblNewLabel_2_3 = new JLabel("First Name");

lblNewLabel_2_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_3.setForeground(Color.WHITE);

lblNewLabel_2_3.setBounds(107, 352, 67, 13);

f.getContentPane().add(lblNewLabel_2_3);

JLabel lblNewLabel_2_3_1 = new JLabel("Middle Name");

lblNewLabel_2_3_1.setForeground(Color.WHITE);

lblNewLabel_2_3_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_3_1.setBounds(309, 353, 82, 13);

f.getContentPane().add(lblNewLabel_2_3_1);

JLabel lblNewLabel_2_3_2 = new JLabel("Last Name");

lblNewLabel_2_3_2.setForeground(Color.WHITE);

lblNewLabel_2_3_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));

lblNewLabel_2_3_2.setBounds(501, 352, 67, 13);

f.getContentPane().add(lblNewLabel_2_3_2);

String[] birthdateDayOptions = new String[31];

for (int i = 0; i < 31; i++) {

birthdateDayOptions[i] = Integer.toString(i + 1);

JLabel birthdateLabel = new JLabel("Birthdate");

birthdateLabel.setBounds(499, 419, 100, 30);

birthdateLabel.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));


birthdateLabel.setForeground(new Color(255, 255, 255));

f.getContentPane().add(birthdateLabel);

JComboBox<String> birthdateDayDropdown = new JComboBox<>(birthdateDayOptions);

birthdateDayDropdown.setBounds(425, 448, 50, 30);

f.getContentPane().add(birthdateDayDropdown);

String[] birthdateMonthOptions = {"January", "February", "March", "April", "May", "June",


"July",

"August", "September", "October", "November", "December"};

JComboBox<String> birthdateMonthDropdown = new


JComboBox<>(birthdateMonthOptions);

birthdateMonthDropdown.setBounds(480, 448, 80, 30);

f.getContentPane().add(birthdateMonthDropdown);

int currentYear = Year.now().getValue();

String[] birthdateYearOptions = new String[50];

for (int i = 0; i < 50; i++) {

birthdateYearOptions[i] = Integer.toString(currentYear - i);

JComboBox<String> birthdateYearDropdown = new JComboBox<>(birthdateYearOptions);

birthdateYearDropdown.setBounds(567, 448, 80, 30);

f.getContentPane().add(birthdateYearDropdown);

JTextField ageField = new JTextField();

ageField.setBounds(585, 490, 62, 30);

f.getContentPane().add(ageField);

ActionListener birthdateListener = new ActionListener() {

@Override

public void actionPerformed(ActionEvent e) {

int selectedDay = Integer.parseInt((String) birthdateDayDropdown.getSelectedItem());


int selectedMonth = birthdateMonthDropdown.getSelectedIndex() + 1;

int selectedYear = Integer.parseInt((String) birthdateYearDropdown.getSelectedItem());

LocalDate birthdate = LocalDate.of(selectedYear, selectedMonth, selectedDay);

LocalDate now = LocalDate.now();

int age = Period.between(birthdate, now).getYears();

ageField.setText(Integer.toString(age));

};

birthdateDayDropdown.addActionListener(birthdateListener);

birthdateMonthDropdown.addActionListener(birthdateListener);

birthdateYearDropdown.addActionListener(birthdateListener);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String username = userr.getText();

String email = emailact.getText();

String pass = new String(passwo.getPassword());

String fname = fnameact.getText();

String mname = mnameact.getText();

String lname = lnameact.getText();

String birthdateDay = (String) birthdateDayDropdown.getSelectedItem();

String birthdateMonth = (String) birthdateMonthDropdown.getSelectedItem();

String birthdateYear = (String) birthdateYearDropdown.getSelectedItem();

String age = ageField.getText();

if (fname.isEmpty() || mname.isEmpty() || lname.isEmpty() || email.isEmpty() ||


username.isEmpty() || pass.isEmpty()) {

JOptionPane.showMessageDialog(f, "All fields must be filled out.", "Error",


JOptionPane.ERROR_MESSAGE);
return;

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Insert into server1 table

String sqlServer1 = "INSERT INTO server1 (user_firstname, user_middlename,


user_lastname, user_email, Username, Password, UserType, birthdate_day, birthdate_month,
birthdate_year, age) " +

"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

PreparedStatement stmtServer1 = conn.prepareStatement(sqlServer1);

// Hash the password

String hashedPassword = hashPassword(String.valueOf(pass));

// Set parameters in the prepared statement for server1

stmtServer1.setString(1, fname);

stmtServer1.setString(2, mname);

stmtServer1.setString(3, lname);

stmtServer1.setString(4, email);

stmtServer1.setString(5, username);

stmtServer1.setString(6, hashedPassword);

stmtServer1.setString(7, "CLIENT");

stmtServer1.setString(8, birthdateDay);

stmtServer1.setString(9, birthdateMonth);

stmtServer1.setString(10, birthdateYear);

stmtServer1.setString(11, age);

// Execute the update for server1

stmtServer1.executeUpdate();
// Insert into test table

String sqlTest = "INSERT INTO test (username) VALUES (?)";

PreparedStatement stmtTest = conn.prepareStatement(sqlTest);

stmtTest.setString(1, username);

// Execute the update for test

stmtTest.executeUpdate();

// Close resources and clear fields

stmtServer1.close();

stmtTest.close();

conn.close();

JOptionPane.showMessageDialog(null, "Registration Complete!");

fnameact.setText("");

mnameact.setText("");

lnameact.setText("");

emailact.setText("");

userr.setText("");

passwo.setText("");

// Close the registration frame and open the login frame

f.dispose();

JFrame loginFrame = createLoginFrame(username);

loginFrame.setVisible(true);

} catch (SQLException | ClassNotFoundException e1) {

e1.printStackTrace();

JOptionPane.showMessageDialog(null, e1);

}
});

btnSignUp.setBounds(335, 613, 117, 40);

f.getContentPane().add(btnSignUp);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 686, 673);

f.getContentPane().add(backgroundLabel);

f.setVisible(true);

return con;

private JFrame createMoviesframe(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(800, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/pink.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JButton btnMovies_1_1 = new JButton("LIBRARY");

btnMovies_1_1.setBackground(new Color(255, 128, 128));


btnMovies_1_1.setFont(new Font("Tahoma", Font.BOLD, 20));

btnMovies_1_1.setBounds(196, 596, 151, 42);

btnMovies_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame LibraryFrame = createLibraryFrame(username);

LibraryFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnMovies_1_1);

JButton btnMovies_1_2 = new JButton("HOME");

btnMovies_1_2.setBackground(new Color(255, 128, 128));

btnMovies_1_2.setFont(new Font("Tahoma", Font.BOLD, 20));

btnMovies_1_2.setBounds(418, 596, 151, 42);

f.getContentPane().add(btnMovies_1_2);

JLabel lblNewLabel_1 = new JLabel("CINEMASAYA");

lblNewLabel_1.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblNewLabel_1.setForeground(new Color(0, 0, 0));

lblNewLabel_1.setBounds(22, 29, 420, 59);

f.getContentPane().add(lblNewLabel_1);

String[] movies = {"","BILLY MADISON","CAN'T HELP FALLING IN LOVE","CHARLIE


CHAPLIN","HOME ALONE","MR. BEAN'S HOLIDAY","ONE DAY","RATATOUILLE",

"TALK TO ME","THE CONJURING","THE ANGRY BIRDS","THE FAULT IN OUR


STARS","THE NUN","THE NOTEBOOK", "TROLLS", "WRECK-IT RALPH","WINNIE THE POOH"};

JComboBox<String> movieComboBox = new JComboBox<>(movies);

movieComboBox.setBounds(279, 43, 210, 30);

f.getContentPane().add(movieComboBox);
JButton searchButton = new JButton("Search");

searchButton.setBounds(487, 43, 100, 30);

f.getContentPane().add(searchButton);

searchButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String selectedMovie = (String) movieComboBox.getSelectedItem();

searchMovie(selectedMovie, username, f);

});

JButton btnNewButton_1_3 = new JButton("KIDS");

btnNewButton_1_3.setFont(new Font("HP Simplified Hans", Font.BOLD, 15));

btnNewButton_1_3.setBackground(new Color(255, 128, 192));

btnNewButton_1_3.setBounds(196, 445, 120, 42);

btnNewButton_1_3.setFocusable(false);

btnNewButton_1_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame kidsFrame = createKidsFrame(username);

kidsFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1_3);

JButton btnNewButton = new JButton("\u2630");

btnNewButton.setBackground(new Color(255, 128, 128));

btnNewButton.setBounds(687, 17, 75, 46);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {


// Call the method to create the registration frame

JFrame loginFrame = createDetailsframe(username);

loginFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1_5 = new JButton("HORROR");

btnNewButton_1_5.setFont(new Font("HP Simplified Hans", Font.BOLD, 15));

btnNewButton_1_5.setBackground(new Color(255, 128, 192));

btnNewButton_1_5.setBounds(445, 501, 120, 42);

btnNewButton_1_5.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame horrorFrame = createHorrorFrame(username);

horrorFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1_5);

JButton btnNewButton_1_1 = new JButton("ROMANCE");

btnNewButton_1_1.setFont(new Font("HP Simplified Hans", Font.BOLD, 15));

btnNewButton_1_1.setBackground(new Color(255, 128, 192));

btnNewButton_1_1.setBounds(196, 501, 120, 42);

btnNewButton_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame romanceFrame = createRomanceFrame(username);


romanceFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1_1);

JButton btnNewButton_1_8 = new JButton("COMEDY");

btnNewButton_1_8.setFont(new Font("HP Simplified Hans", Font.BOLD, 15));

btnNewButton_1_8.setBackground(new Color(255, 128, 192));

btnNewButton_1_8.setBounds(445, 445, 120, 42);

btnNewButton_1_8.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame comedyFrame = createComedyFrame(username);

comedyFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1_8);

JPanel panel = new JPanel();

panel.setBounds(138, 113, 500, 300);

panel.setLayout(new BorderLayout()); // Set layout manager

f.getContentPane().add(panel);

// Initialize images with resizing

images = new ImageIcon[4];

images[0] = resizeImageIcon(new ImageIcon(getClass().getResource("/comedy4.jpg")));

images[1] = resizeImageIcon(new ImageIcon(getClass().getResource("/winnie.jpg")));


images[2] = resizeImageIcon(new ImageIcon(getClass().getResource("/Trollskids.jpg")));

images[3] = resizeImageIcon(new ImageIcon(getClass().getResource("/romance3.jpg")));

// Initialize label to display images

imageLabel = new JLabel();

imageLabel.setHorizontalAlignment(JLabel.CENTER);

imageLabel.setIcon(images[currentImageIndex]);

panel.add(imageLabel, BorderLayout.CENTER);

// Timer to change images

timer = new Timer(2000, new ActionListener() { // Change image every 3 seconds

@Override

public void actionPerformed(ActionEvent e) {

currentImageIndex = (currentImageIndex + 1) % images.length;

imageLabel.setIcon(images[currentImageIndex]);

});

timer.start();

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(-14, 0, 810, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

}
private JFrame createRentFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 15));

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createKidsFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);


JLabel lblhm = new JLabel("1h 37m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Angrybirds.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblKids = new JLabel("KIDS");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("THE ANGRY BIRDS");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 475, 162, 13);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>(2016) is an animated


comedy film based on the popular video game series by Rovio Entertainment. The story is set on Bird
Island, home to flightless birds who lead a generally peaceful life. However, Red, an angry and
reclusive bird, struggles with his temper and is often ostracized by the other birds. After an outburst
at a children's party, Red is sentenced to anger management classes, where he meets Chuck, a
hyperactive canary, and Bomb, a gentle giant who literally explodes when he gets angry.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));


lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 150 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));


lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query


String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");
// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createKidsFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");


f.getContentPane().setBackground(Color.BLACK);

f.setSize(1069, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/star.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JButton btnNewButton_1_1 = new JButton("RENT");

btnNewButton_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1.setBounds(103, 553, 91, 29);

btnNewButton_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to


rent this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "THE ANGRY BIRDS"; // Replace lblTheAngryBirds with the


appropriate label for the movie title

String price = "150"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");
// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try


again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1);

JButton lblTrolls = new JButton("TROLLS");

lblTrolls.setForeground(new Color(0, 0, 0));

lblTrolls.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTrolls.setBounds(345, 499, 91, 25);

lblTrolls.setContentAreaFilled(false);

lblTrolls.setBorderPainted(false);

lblTrolls.setForeground(Color.BLACK);

lblTrolls.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent2Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblTrolls);

JLabel lblTitle_1 = new JLabel("Title:");

lblTitle_1.setForeground(new Color(0, 0, 0));

lblTitle_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_1.setBounds(300, 493, 52, 37);

f.getContentPane().add(lblTitle_1);
JButton lblR = new JButton("RATATOUILLE");

lblR.setForeground(new Color(0, 0, 0));

lblR.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblR.setContentAreaFilled(false);

lblR.setBorderPainted(false);

lblR.setForeground(Color.BLACK);

lblR.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent4Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

lblR.setBounds(847, 499, 135, 25);

f.getContentPane().add(lblR);

JButton lblWreckitRalph = new JButton("WRECK-IT RALPH");

lblWreckitRalph.setForeground(new Color(0, 0, 0));

lblWreckitRalph.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblWreckitRalph.setContentAreaFilled(false);

lblWreckitRalph.setBorderPainted(false);

lblWreckitRalph.setForeground(Color.BLACK);

lblWreckitRalph.setBounds(598, 499, 155, 25);

lblWreckitRalph.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent3Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblWreckitRalph);
JLabel lblTitle_3 = new JLabel("Title:");

lblTitle_3.setForeground(new Color(0, 0, 0));

lblTitle_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_3.setBounds(800, 498, 52, 37);

f.getContentPane().add(lblTitle_3);

JButton lblTheAngryBirds = new JButton("THE ANGRY BIRDS");

lblTheAngryBirds.setForeground(new Color(0, 0, 0));

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTheAngryBirds.setContentAreaFilled(false);

lblTheAngryBirds.setBorderPainted(false);

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRentFrame(username);

rentFrame.setVisible(true);

f.dispose();

});

lblTheAngryBirds.setBounds(88, 499, 187, 25);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblTitle_2 = new JLabel("Title:");

lblTitle_2.setForeground(new Color(0, 0, 0));

lblTitle_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_2.setBounds(549, 498, 65, 37);

f.getContentPane().add(lblTitle_2);

JLabel lblRating_1 = new JLabel("Price: 150");

lblRating_1.setForeground(Color.BLACK);
lblRating_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_1.setBounds(300, 521, 162, 37);

f.getContentPane().add(lblRating_1);

JLabel lblRating = new JLabel("Price: 150");

lblRating.setForeground(Color.BLACK);

lblRating.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating.setBounds(50, 521, 162, 37);

f.getContentPane().add(lblRating);

JLabel lblRating_2 = new JLabel("Price: 150");

lblRating_2.setForeground(Color.BLACK);

lblRating_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_2.setBounds(550, 521, 162, 37);

f.getContentPane().add(lblRating_2);

JLabel lblRating_3 = new JLabel("Price: 150");

lblRating_3.setForeground(Color.BLACK);

lblRating_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_3.setBounds(800, 521, 162, 37);

f.getContentPane().add(lblRating_3);

JButton btnNewButton_1_1_1 = new JButton("RENT");

btnNewButton_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_1.setBounds(353, 553, 91, 29);

btnNewButton_1_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {
String title = "TROLLS"; // Replace lblTheAngryBirds with the appropriate label for
the movie title

String price = "150"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources
pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_1);

JButton btnNewButton_1_1_2 = new JButton("RENT");

btnNewButton_1_1_2.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_2.setBounds(609, 560, 91, 29);

btnNewButton_1_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "WRECK-IT RALPH"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "150"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");
// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();
} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_2);

JLabel lblTitle = new JLabel("Title:");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle.setBounds(50, 493, 47, 37);

f.getContentPane().add(lblTitle);

JButton btnNewButton_1_1_3 = new JButton("RENT");

btnNewButton_1_1_3.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_3.setBounds(863, 560, 91, 29);

btnNewButton_1_1_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "RATATOUILLE"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "150"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection


Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {


// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_3);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(50, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Angrybirds.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

// Add second picture

JLabel pictureLabel2 = new JLabel();

pictureLabel2.setBounds(300, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon2 = new ImageIcon(getClass().getResource("/Trollskids.jpg"));

pictureLabel2.setIcon(new
ImageIcon(imageIcon2.getImage().getScaledInstance(pictureLabel2.getWidth(),
pictureLabel2.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel2);

JLabel pictureLabel3 = new JLabel();

pictureLabel3.setBounds(550, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon3 = new ImageIcon(getClass().getResource("/ralph.jpg"));

pictureLabel3.setIcon(new
ImageIcon(imageIcon3.getImage().getScaledInstance(pictureLabel3.getWidth(),
pictureLabel3.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel3);
JLabel pictureLabel4 = new JLabel();

pictureLabel4.setBounds(800, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon4 = new ImageIcon(getClass().getResource("/rata.jpg"));

pictureLabel4.setIcon(new
ImageIcon(imageIcon4.getImage().getScaledInstance(pictureLabel4.getWidth(),
pictureLabel4.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel4);

JLabel lblKids = new JLabel("KIDS");

lblKids.setForeground(new Color(0, 0, 0));

lblKids.setFont(new Font("Tahoma", Font.BOLD, 40));

lblKids.setBounds(474, 93, 162, 37);

f.getContentPane().add(lblKids);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(33, 27, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 15));

btnNewButton_1.setBounds(935, 27, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame MenuFrame = createMoviesframe(username);

MenuFrame.setVisible(true);

f.dispose();

});
f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(-35, 0, 1129, 673);

f.getContentPane().add(backgroundLabel);

f.getContentPane().setComponentZOrder(backgroundLabel,
f.getContentPane().getComponentCount() - 1);

return f;

private JFrame createComedyFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1069, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/star.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);


JButton btnNewButton_1_1 = new JButton("RENT");

btnNewButton_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1.setBounds(103, 553, 91, 29);

btnNewButton_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "CHARLIE CHAPLIN"; // Replace lblTheAngryBirds with the


appropriate label for the movie title

String price = "175"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query


int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try


again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

JButton lblCharlieChaplin = new JButton("Charlie Chaplin");

lblCharlieChaplin.setForeground(new Color(0, 0, 0));

lblCharlieChaplin.setFont(new Font("Tahoma", Font.BOLD, 14));

lblCharlieChaplin.setBounds(103, 497, 147, 25);


lblCharlieChaplin.setContentAreaFilled(false);

lblCharlieChaplin.setBorderPainted(false);

lblCharlieChaplin.setForeground(Color.BLACK);

lblCharlieChaplin.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent11Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblCharlieChaplin);

JButton lblMrBeansHoliday = new JButton("MR. BEAN'S HOLIDAY");

lblMrBeansHoliday.setForeground(new Color(0, 0, 0));

lblMrBeansHoliday.setFont(new Font("Tahoma", Font.BOLD, 14));

lblMrBeansHoliday.setBounds(854, 497, 191, 25);

lblMrBeansHoliday.setContentAreaFilled(false);

lblMrBeansHoliday.setBorderPainted(false);

lblMrBeansHoliday.setForeground(Color.BLACK);

lblMrBeansHoliday.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent14Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblMrBeansHoliday);

JButton lblHomeAlone = new JButton("HOME ALONE");

lblHomeAlone.setForeground(new Color(0, 0, 0));


lblHomeAlone.setFont(new Font("Tahoma", Font.BOLD, 14));

lblHomeAlone.setBorderPainted(false);

lblHomeAlone.setContentAreaFilled(false);

lblHomeAlone.setForeground(Color.BLACK);

lblHomeAlone.setBounds(361, 497, 139, 25);

lblHomeAlone.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent12Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblHomeAlone);

JButton lblBilltyMadison = new JButton("Billy Madison");

lblBilltyMadison.setForeground(new Color(0, 0, 0));

lblBilltyMadison.setFont(new Font("Tahoma", Font.BOLD, 14));

lblBilltyMadison.setBounds(611, 497, 139, 25);

lblBilltyMadison.setContentAreaFilled(false);

lblBilltyMadison.setBorderPainted(false);

lblBilltyMadison.setForeground(Color.BLACK);

lblBilltyMadison.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent13Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblBilltyMadison);

JLabel lblRating_1 = new JLabel("Price: 175");


lblRating_1.setForeground(Color.BLACK);

lblRating_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_1.setBounds(300, 521, 162, 37);

f.getContentPane().add(lblRating_1);

JLabel lblRating = new JLabel("Price: 175");

lblRating.setForeground(Color.BLACK);

lblRating.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating.setBounds(50, 521, 162, 37);

f.getContentPane().add(lblRating);

JLabel lblRating_2 = new JLabel("Price: 175");

lblRating_2.setForeground(Color.BLACK);

lblRating_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_2.setBounds(550, 521, 162, 37);

f.getContentPane().add(lblRating_2);

JLabel lblRating_3 = new JLabel("Price: 175");

lblRating_3.setForeground(Color.BLACK);

lblRating_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_3.setBounds(800, 521, 162, 37);

f.getContentPane().add(lblRating_3);

JLabel lblTitle_3 = new JLabel("Title:");

lblTitle_3.setForeground(new Color(0, 0, 0));

lblTitle_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_3.setBounds(800, 498, 74, 37);

f.getContentPane().add(lblTitle_3);

JButton btnNewButton_1_1_1 = new JButton("RENT");

btnNewButton_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));


btnNewButton_1_1_1.setBounds(353, 553, 91, 29);

btnNewButton_1_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "HOME ALONE"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "175"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful


if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try


again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_1);

JButton btnNewButton_1_1_2 = new JButton("RENT");

btnNewButton_1_1_2.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_2.setBounds(609, 560, 91, 29);

btnNewButton_1_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {


int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent
this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "BILLY MADISON"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "175"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try


again.");
}

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_2);

JLabel lblTitle = new JLabel("Title:");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle.setBounds(50, 493, 65, 37);

f.getContentPane().add(lblTitle);

JLabel lblTitle_2 = new JLabel("Title:");

lblTitle_2.setForeground(new Color(0, 0, 0));

lblTitle_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_2.setBounds(550, 493, 63, 37);

f.getContentPane().add(lblTitle_2);
JLabel lblTitle_1 = new JLabel("Title:");

lblTitle_1.setForeground(new Color(0, 0, 0));

lblTitle_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_1.setBounds(300, 493, 71, 37);

f.getContentPane().add(lblTitle_1);

JButton btnNewButton_1_1_3 = new JButton("RENT");

btnNewButton_1_1_3.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_3.setBounds(863, 560, 91, 29);

btnNewButton_1_1_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "MR BEAN'S HOLIDAY"; // Replace lblTheAngryBirds with the


appropriate label for the movie title

String price = "175"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES


(?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters


pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try


again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});
f.getContentPane().add(btnNewButton_1_1_3);

f.getContentPane().add(btnNewButton_1_1);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(50, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/comedy1.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

// Add second picture

JLabel pictureLabel2 = new JLabel();

pictureLabel2.setBounds(300, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon2 = new ImageIcon(getClass().getResource("/comedy2.jpg"));

pictureLabel2.setIcon(new
ImageIcon(imageIcon2.getImage().getScaledInstance(pictureLabel2.getWidth(),
pictureLabel2.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel2);

JLabel pictureLabel3 = new JLabel();

pictureLabel3.setBounds(550, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon3 = new ImageIcon(getClass().getResource("/comedy3.jpg"));

pictureLabel3.setIcon(new
ImageIcon(imageIcon3.getImage().getScaledInstance(pictureLabel3.getWidth(),
pictureLabel3.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel3);

JLabel pictureLabel4 = new JLabel();

pictureLabel4.setBounds(800, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon4 = new ImageIcon(getClass().getResource("/comedy4.jpg"));

pictureLabel4.setIcon(new
ImageIcon(imageIcon4.getImage().getScaledInstance(pictureLabel4.getWidth(),
pictureLabel4.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel4);

JLabel lblKids = new JLabel("COMEDY");

lblKids.setForeground(new Color(0, 0, 0));

lblKids.setFont(new Font("Tahoma", Font.BOLD, 40));

lblKids.setBounds(435, 93, 238, 37);

f.getContentPane().add(lblKids);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(33, 27, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 15));

btnNewButton_1.setBounds(935, 27, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame MenuFrame = createMoviesframe(username);

MenuFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);


backgroundLabel.setBounds(-35, 0, 1129, 673);

f.getContentPane().add(backgroundLabel);

f.getContentPane().setComponentZOrder(backgroundLabel,
f.getContentPane().getComponentCount() - 1);

JLabel lblTitle_3_1 = new JLabel("TITLE:");

lblTitle_3_1.setForeground(Color.BLACK);

lblTitle_3_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_3_1.setBounds(880, 498, 74, 37);

f.getContentPane().add(lblTitle_3_1);

return f;

private JFrame createHorrorFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1069, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/star.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);
ImageIcon backgroundImage = new ImageIcon(resizedImage);

JButton btnNewButton_1_1 = new JButton("RENT");

btnNewButton_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1.setBounds(103, 553, 91, 29);

btnNewButton_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "THE NUN"; // Replace lblTheAngryBirds with the appropriate label for
the movie title

String price = "250"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query


int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1);

JButton lblTalkToMe = new JButton("TALK TO ME");

lblTalkToMe.setForeground(Color.BLACK);

lblTalkToMe.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTalkToMe.setBounds(353, 496, 131, 29);


lblTalkToMe.setContentAreaFilled(false);

lblTalkToMe.setBorderPainted(false);

lblTalkToMe.setForeground(Color.BLACK);

lblTalkToMe.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent22Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblTalkToMe);

JButton lblTheConjuring = new JButton("THE CONJURING");

lblTheConjuring.setForeground(Color.BLACK);

lblTheConjuring.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTheConjuring.setBounds(852, 496, 162, 29);

lblTheConjuring.setContentAreaFilled(false);

lblTheConjuring.setBorderPainted(false);

lblTheConjuring.setForeground(Color.BLACK);

lblTheConjuring.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent24Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblTheConjuring);

JButton lblWinnieThePooh = new JButton("WINNIE THE POOH");

lblWinnieThePooh.setForeground(Color.BLACK);
lblWinnieThePooh.setFont(new Font("Tahoma", Font.BOLD, 14));

lblWinnieThePooh.setBounds(590, 496, 180, 29);

lblWinnieThePooh.setContentAreaFilled(false);

lblWinnieThePooh.setBorderPainted(false);

lblWinnieThePooh.setForeground(Color.BLACK);

lblWinnieThePooh.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent23Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblWinnieThePooh);

JButton lblTheNun = new JButton("THE NUN");

lblTheNun.setForeground(Color.BLACK);

lblTheNun.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTheNun.setBounds(103, 496, 104, 29);

lblTheNun.setContentAreaFilled(false);

lblTheNun.setBorderPainted(false);

lblTheNun.setForeground(Color.BLACK);

lblTheNun.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent21Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblTheNun);

JLabel lblRating_1 = new JLabel("Price: 250");


lblRating_1.setForeground(Color.BLACK);

lblRating_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_1.setBounds(300, 521, 162, 37);

f.getContentPane().add(lblRating_1);

JLabel lblRating = new JLabel("Price: 250");

lblRating.setForeground(Color.BLACK);

lblRating.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating.setBounds(50, 521, 162, 37);

f.getContentPane().add(lblRating);

JLabel lblRating_2 = new JLabel("Price: 250");

lblRating_2.setForeground(Color.BLACK);

lblRating_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_2.setBounds(550, 521, 162, 37);

f.getContentPane().add(lblRating_2);

JLabel lblRating_3 = new JLabel("Price: 250");

lblRating_3.setForeground(Color.BLACK);

lblRating_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_3.setBounds(800, 521, 162, 37);

f.getContentPane().add(lblRating_3);

JLabel lblTitle_3 = new JLabel("Title:");

lblTitle_3.setForeground(new Color(0, 0, 0));

lblTitle_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_3.setBounds(800, 493, 59, 37);

f.getContentPane().add(lblTitle_3);

JButton btnNewButton_1_1_1 = new JButton("RENT");

btnNewButton_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));


btnNewButton_1_1_1.setBounds(353, 553, 91, 29);

btnNewButton_1_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "TALK TO ME"; // Replace lblTheAngryBirds with the appropriate label
for the movie title

String price = "250"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");


} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_1);

JButton btnNewButton_1_1_2 = new JButton("RENT");

btnNewButton_1_1_2.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_2.setBounds(609, 560, 91, 29);

btnNewButton_1_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "WINNIE THE POOH"; // Replace lblTheAngryBirds with the appropriate
label for the movie title
String price = "250"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();
// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_2);

JLabel lblTitle = new JLabel("TITLE:");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle.setBounds(50, 493, 59, 37);

f.getContentPane().add(lblTitle);

JLabel lblTitle_2 = new JLabel("Title:");

lblTitle_2.setForeground(new Color(0, 0, 0));

lblTitle_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_2.setBounds(550, 493, 64, 37);

f.getContentPane().add(lblTitle_2);

JLabel lblTitle_1 = new JLabel("Title:");

lblTitle_1.setForeground(new Color(0, 0, 0));

lblTitle_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_1.setBounds(300, 493, 61, 37);


f.getContentPane().add(lblTitle_1);

JButton btnNewButton_1_1_3 = new JButton("RENT");

btnNewButton_1_1_3.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_3.setBounds(863, 560, 91, 29);

btnNewButton_1_1_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "THE CONJURING"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "250"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();


// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_3);

f.getContentPane().add(btnNewButton_1_1);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(50, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Nunhorror.jpg"));


pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

// Add second picture

JLabel pictureLabel2 = new JLabel();

pictureLabel2.setBounds(300, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon2 = new ImageIcon(getClass().getResource("/talktome.jpg"));

pictureLabel2.setIcon(new
ImageIcon(imageIcon2.getImage().getScaledInstance(pictureLabel2.getWidth(),
pictureLabel2.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel2);

JLabel pictureLabel3 = new JLabel();

pictureLabel3.setBounds(550, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon3 = new ImageIcon(getClass().getResource("/winnie.jpg"));

pictureLabel3.setIcon(new
ImageIcon(imageIcon3.getImage().getScaledInstance(pictureLabel3.getWidth(),
pictureLabel3.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel3);

JLabel pictureLabel4 = new JLabel();

pictureLabel4.setBounds(800, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon4 = new ImageIcon(getClass().getResource("/Conjhorror.jpg"));

pictureLabel4.setIcon(new
ImageIcon(imageIcon4.getImage().getScaledInstance(pictureLabel4.getWidth(),
pictureLabel4.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel4);

JLabel lblKids = new JLabel("HORROR");

lblKids.setForeground(new Color(0, 0, 0));

lblKids.setFont(new Font("Tahoma", Font.BOLD, 40));

lblKids.setBounds(437, 93, 238, 37);


f.getContentPane().add(lblKids);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(33, 27, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 15));

btnNewButton_1.setBounds(935, 27, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame MenuFrame = createMoviesframe(username);

MenuFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(-35, 0, 1129, 663);

f.getContentPane().add(backgroundLabel);

f.getContentPane().setComponentZOrder(backgroundLabel,
f.getContentPane().getComponentCount() - 1);

return f;

private JFrame createRomanceFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1069, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/star.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JButton btnNewButton_1_1 = new JButton("RENT");

btnNewButton_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1.setBounds(103, 553, 91, 29);

btnNewButton_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) {

String title = "ONE DAY"; // Replace lblTheAngryBirds with the appropriate label for
the movie title

String price = "190"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources
pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1);

JButton lblTheNotebook = new JButton("THE NOTEBOOK");

lblTheNotebook.setForeground(Color.BLACK);

lblTheNotebook.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTheNotebook.setBounds(600, 500, 160, 24);

lblTheNotebook.setContentAreaFilled(false);

lblTheNotebook.setBorderPainted(false);

lblTheNotebook.setForeground(Color.BLACK);

lblTheNotebook.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent33Frame(username);

rentFrame.setVisible(true);

f.dispose();

});
f.getContentPane().add(lblTheNotebook);

JButton lblLoveWhisper = new JButton("Can't Help Falling in love");

lblLoveWhisper.setForeground(Color.BLACK);

lblLoveWhisper.setFont(new Font("Tahoma", Font.BOLD, 14));

lblLoveWhisper.setBounds(839, 500, 216, 24);

lblLoveWhisper.setContentAreaFilled(false);

lblLoveWhisper.setBorderPainted(false);

lblLoveWhisper.setForeground(Color.BLACK);

lblLoveWhisper.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent34Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblLoveWhisper);

JButton lblOneDay = new JButton("One Day");

lblOneDay.setForeground(Color.BLACK);

lblOneDay.setFont(new Font("Tahoma", Font.BOLD, 14));

lblOneDay.setBounds(103, 496, 102, 28);

lblOneDay.setContentAreaFilled(false);

lblOneDay.setBorderPainted(false);

lblOneDay.setForeground(Color.BLACK);

lblOneDay.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent31Frame(username);

rentFrame.setVisible(true);

f.dispose();

}
});

f.getContentPane().add(lblOneDay);

JButton lblTheFaultIn = new JButton("The Fault In Our Stars");

lblTheFaultIn.setForeground(Color.BLACK);

lblTheFaultIn.setFont(new Font("Tahoma", Font.BOLD, 14));

lblTheFaultIn.setBounds(335, 496, 205, 28);

lblTheFaultIn.setContentAreaFilled(false);

lblTheFaultIn.setBorderPainted(false);

lblTheFaultIn.setForeground(Color.BLACK);

lblTheFaultIn.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame rentFrame = createRent32Frame(username);

rentFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(lblTheFaultIn);

JLabel lblRating_1 = new JLabel("Price: 190");

lblRating_1.setForeground(Color.BLACK);

lblRating_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_1.setBounds(300, 521, 162, 37);

f.getContentPane().add(lblRating_1);

JLabel lblRating = new JLabel("Price: 190");

lblRating.setForeground(Color.BLACK);

lblRating.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating.setBounds(50, 521, 162, 37);

f.getContentPane().add(lblRating);
JLabel lblRating_2 = new JLabel("Price: 190");

lblRating_2.setForeground(Color.BLACK);

lblRating_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_2.setBounds(550, 521, 162, 37);

f.getContentPane().add(lblRating_2);

JLabel lblRating_3 = new JLabel("Price: 190");

lblRating_3.setForeground(Color.BLACK);

lblRating_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblRating_3.setBounds(800, 521, 162, 37);

f.getContentPane().add(lblRating_3);

JLabel lblTitle_3 = new JLabel("Title:");

lblTitle_3.setForeground(new Color(0, 0, 0));

lblTitle_3.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_3.setBounds(800, 493, 68, 37);

f.getContentPane().add(lblTitle_3);

JButton btnNewButton_1_1_1 = new JButton("RENT");

btnNewButton_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_1.setBounds(353, 553, 91, 29);

btnNewButton_1_1_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "THE FAULT OF OUR STARS"; // Replace lblTheAngryBirds with the
appropriate label for the movie title

String price = "190"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver


Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);
f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_1);

JButton btnNewButton_1_1_2 = new JButton("RENT");

btnNewButton_1_1_2.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_2.setBounds(609, 560, 91, 29);

btnNewButton_1_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "THE NOTEBOOK"; // Replace lblTheAngryBirds with the appropriate


label for the movie title

String price = "190"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";
PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();

// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

}
}

});

f.getContentPane().add(btnNewButton_1_1_2);

JLabel lblTitle = new JLabel("Title:");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle.setBounds(50, 493, 50, 37);

f.getContentPane().add(lblTitle);

JLabel lblTitle_2 = new JLabel("Title:");

lblTitle_2.setForeground(new Color(0, 0, 0));

lblTitle_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_2.setBounds(550, 493, 68, 37);

f.getContentPane().add(lblTitle_2);

JLabel lblTitle_1 = new JLabel("Title:");

lblTitle_1.setForeground(new Color(0, 0, 0));

lblTitle_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 13));

lblTitle_1.setBounds(300, 493, 58, 37);

f.getContentPane().add(lblTitle_1);

JButton btnNewButton_1_1_3 = new JButton("RENT");

btnNewButton_1_1_3.setFont(new Font("Tahoma", Font.BOLD, 17));

btnNewButton_1_1_3.setBounds(863, 560, 91, 29);

btnNewButton_1_1_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(null, "Are you sure you want to rent


this movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = "CAN'T HELP FALLING INLOVE"; // Replace lblTheAngryBirds with the
appropriate label for the movie title
String price = "190"; // Replace lblPrice with the appropriate label for the price

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Close resources

pst.close();

conn.close();
// Open the library frame and dispose the current frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton_1_1_3);

f.getContentPane().add(btnNewButton_1_1);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(50, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/romance1.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

// Add second picture

JLabel pictureLabel2 = new JLabel();

pictureLabel2.setBounds(300, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon2 = new ImageIcon(getClass().getResource("/romance2.jpg"));

pictureLabel2.setIcon(new
ImageIcon(imageIcon2.getImage().getScaledInstance(pictureLabel2.getWidth(),
pictureLabel2.getHeight(), Image.SCALE_SMOOTH)));
f.getContentPane().add(pictureLabel2);

JLabel pictureLabel3 = new JLabel();

pictureLabel3.setBounds(550, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon3 = new ImageIcon(getClass().getResource("/romance3.jpg"));

pictureLabel3.setIcon(new
ImageIcon(imageIcon3.getImage().getScaledInstance(pictureLabel3.getWidth(),
pictureLabel3.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel3);

JLabel pictureLabel4 = new JLabel();

pictureLabel4.setBounds(800, 188, 200, 300); // Set desired bounds

ImageIcon imageIcon4 = new ImageIcon(getClass().getResource("/romance5.jpg"));

pictureLabel4.setIcon(new
ImageIcon(imageIcon4.getImage().getScaledInstance(pictureLabel4.getWidth(),
pictureLabel4.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel4);

JLabel lblKids = new JLabel("ROMANCE");

lblKids.setForeground(new Color(0, 0, 0));

lblKids.setFont(new Font("Tahoma", Font.BOLD, 40));

lblKids.setBounds(425, 93, 238, 37);

f.getContentPane().add(lblKids);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(33, 27, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 15));


btnNewButton_1.setBounds(935, 27, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame MenuFrame = createMoviesframe(username);

MenuFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(-35, 0, 1129, 679);

f.getContentPane().add(backgroundLabel);

f.getContentPane().setComponentZOrder(backgroundLabel,
f.getContentPane().getComponentCount() - 1);

return f;

private JFrame createRent2Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");


f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 32m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("KIDS");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("TROLLS");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 475, 162, 13);

f.getContentPane().add(lblTheAngryBirds);
JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>After the Bergens invade
Troll Village, Poppy, the happiest Troll ever born, and the curmudgeonly Branch set off on a journey
to rescue her friends. When their village is invaded by the grumpy Bergens, two mismatched friends
must work together in perfect harmony to save the day.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 150");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);


f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Trollskids.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {
}

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");
// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame


JFrame moviesFrame = createKidsFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

});

btnSignUp.setBounds(335, 613, 117, 40);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent3Frame(String username) {


JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 41m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("KIDS");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("WRECK-IT RALPH");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 475, 162, 13);


f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>Wreck-It Ralph is the 9-


foot-tall, 643-pound villain of an arcade video game named Fix-It Felix Jr., in which the game's titular
hero fixes buildings that Ralph destroys. Wanting to prove he can be a good guy and not just a villain,
Ralph escapes his game and lands in Hero's Duty, a first-person shooter where he helps the game's
hero battle against alien invaders. He later enters Sugar Rush, a kart racing game set on tracks made
of candies, cookies and other sweets. There, Ralph meets Vanellope von Schweetz who has learned
that her game is faced with a dire threat that could affect the entire arcade, and one that Ralph may
have inadvertently started.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 150");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);
JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/ralph.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");


lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);


btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createKidsFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent4Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);
f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 51m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("KIDS");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("RATATOUILLE");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 475, 162, 13);

f.getContentPane().add(lblTheAngryBirds);
JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>A rat named Remy dreams
of becoming a great chef despite his family's wishes, and the obvious problem of being a rat in a
decidedly rodent-phobic profession. When fate places Remy in the sewers of Paris, he finds himself
ideally situated beneath a restaurant made famous by his culinary hero, Auguste Gusteau.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 150");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);
JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/rata.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {
}

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame


JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createKidsFrame(username);


moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

});

btnSignUp.setBounds(335, 613, 117, 40);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent11Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");


f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 27m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("COMEDY");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("CHARLIE CHAPLIN");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);
JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'> (born April 16, 1889,
London, England\u2014died December 25, 1977, Corsier-sur-Vevey, Switzerland) was a British
comedian, producer, writer, director, and composer who is widely regarded as the greatest comic
artist of the screen and one of the most important figures in motion-picture history.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 175");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);


f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/comedy1.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {
}

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");
// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame


JFrame moviesFrame = createComedyFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent12Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);
ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 43m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("COMEDY");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("HOME ALONE");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 475, 162, 13);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>Eight-year-old Kevin


McCallister makes the most of the situation after his family unwittingly leaves him behind when they
go on Christmas vacation. But when a pair of bungling burglars set their sights on Kevin's house, the
plucky kid stands ready to defend his territory. By planting booby traps galore, adorably mischievous
Kevin stands his ground as his frantic mother attempts to race home before Christmas Day.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));


lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 175 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));


lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/comedy2.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();


try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {
JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createComedyFrame(username);

moviesFrame.setVisible(true);

f.dispose();

}
});

f.getContentPane().add(btnNewButton_1);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

});

btnSignUp.setBounds(335, 613, 117, 40);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent13Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);
f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 29m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("COMEDY");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("Billy Madison");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 162, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>Billy Madison is the 27


year-old son of Bryan Madison, a very rich man who has made his living in the hotel industry. Billy
stands to inherit his father's empire but only if he can make it through all 12 grades, 2 weeks per
grade, to prove that he has what it takes to run the family business.");
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 175 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));


lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/comedy3.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();


try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();
} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createComedyFrame(username);

moviesFrame.setVisible(true);

f.dispose();
}

});

f.getContentPane().add(btnNewButton_1);

JButton btnSignUp = new JButton("SIGN UP");

btnSignUp.setFont(new Font("Tahoma", Font.BOLD, 10));

btnSignUp.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

});

btnSignUp.setBounds(335, 613, 117, 40);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

JFrame createRent14Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 30m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("COMEDY");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("MR. BEAN'S HOLIDAY");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'> is going on holiday to the


south of France, looking for a quiet and sunny trip in the Riviera. However, his trip doesn't go as
smoothly as he expected when he has to face a series of misunderstandings and totally unfortunate
coincidences. Eventually, Mr Bean will end up spoiling the last film of the snobbish director Carson
Clay and appearing by accident at the Cannes Film Festival.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 175");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);
JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/comedy4.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

}
String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);


libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createComedyFrame(username);

moviesFrame.setVisible(true);
f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent21Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();


Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),
Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 36m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("HORROR");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("THE NUN");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>A priest with a haunted


past and a novice on the threshold of her final vows are sent by the Vatican to investigate the death
of a young nun in Romania and confront a malevolent force in the form of a demonic nun.\r\nWhen
a young nun at a cloistered abbey in Romania takes her own life, a priest with a haunted past and a
novitiate on the threshold of her final vows are sent by the Vatican to investigate. Together they
uncover the order's unholy secret. Risking not only their lives but their faith and their very souls,
they confront a malevolent force in the form of the same demonic nun that first terrorized
audiences in 'The Conjuring 2,' as the abbey becomes a horrific battleground between the living and
the damned.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));


lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 250 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));


lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Nunhorror.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();


try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {
JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createHorrorFrame(username);

moviesFrame.setVisible(true);

f.dispose();

}
});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent22Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);
ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 35m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("HORROR");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("TALK TO ME");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>The film follows a group of


teenagers who discover they are able to contact spirits using a mysterious severed and embalmed
hand. Talk to Me premiered at the Adelaide Film Festival on 30 October 2022, and was released by
Maslow Entertainment, Umbrella Entertainment, and Ahi Films in Australia on 27 July 2023.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));


lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 250 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/talktome.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");
// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");
// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createHorrorFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);


f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent23Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 24m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);


f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("HORROR");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("WINNIE THE POOH");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>As time passes, feeling


angry and abandoned, the two become feral. After getting a taste for blood, Winnie-The-Pooh and
Piglet set off to find a new source of food.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);


f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 250 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/winnie.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);


f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);
// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createHorrorFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

}
private JFrame createRent24Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 52m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("HORROR");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);
JLabel lblTheAngryBirds = new JLabel("The Conjuring");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>\"The Conjuring\" is a


2013 supernatural horror film directed by James Wan and written by Chad Hayes and Carey W.
Hayes. The movie is the first installment in the \"Conjuring\" Universe franchise and is based on the
true stories of real-life paranormal investigators Ed and Lorraine Warren.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 250 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);
JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/Conjhorror.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);


btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");


lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");


btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createHorrorFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent31Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("1h 47m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("ROMANCE");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("One Day");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>A romantic comedy


centered on Dexter and Emma, who first meet during their graduation in 1988 and proceed to keep
in touch regularly. The film follows what they do on July 15 annually, usually doing something
together.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 190 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);
JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/romance1.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

}
String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);


libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createRomanceFrame(username);

moviesFrame.setVisible(true);
f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent32Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();


Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),
Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("2h 7m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("ROMANCE");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("The Fault In Our Stars");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>Despite the tumor-


shrinking medical miracle that has bought her a few years, Hazel has never been anything but
terminal, her final chapter inscribed upon diagnosis. But when a patient named Augustus Waters
suddenly appears at Cancer Kid Support Group, Hazel's story is about to be completely rewritten.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);
JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 190 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);
JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/romance2.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");
// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

}
// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createRomanceFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);
JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent33Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);


JLabel lblhm = new JLabel("2h 3m");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);

JLabel lblKids = new JLabel("ROMANCE");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("THE NOTEBOOK");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>An epic love story


centered around an older man who reads aloud to a woman with Alzheimer's. From a faded
notebook, the old man's words bring to life the story about a couple who is separated by World War
II, and is then passionately reunited, seven years later, after they have taken different paths.");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);


f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));

lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 190 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/romance3.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));
f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));

lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";
PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available

pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources
pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createRomanceFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);
JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);

return f;

private JFrame createRent34Frame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(1100, 700);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setLocationRelativeTo(null);

ImageIcon originalImageIcon = new ImageIcon(getClass().getResource("/bg.jpg"));

Image originalImage = originalImageIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(f.getWidth(), f.getHeight(),


Image.SCALE_SMOOTH);

ImageIcon backgroundImage = new ImageIcon(resizedImage);

JLabel lblhm = new JLabel("2h");

lblhm.setForeground(Color.BLACK);

lblhm.setFont(new Font("Tahoma", Font.BOLD, 16));

lblhm.setBounds(145, 544, 162, 13);

f.getContentPane().add(lblhm);
JLabel lblKids = new JLabel("ROMANCE");

lblKids.setForeground(Color.BLACK);

lblKids.setFont(new Font("Tahoma", Font.BOLD, 16));

lblKids.setBounds(145, 508, 162, 13);

f.getContentPane().add(lblKids);

JLabel lblTheAngryBirds = new JLabel("Can't Help Falling in love");

lblTheAngryBirds.setForeground(Color.BLACK);

lblTheAngryBirds.setFont(new Font("Tahoma", Font.BOLD, 16));

lblTheAngryBirds.setBounds(145, 470, 212, 23);

f.getContentPane().add(lblTheAngryBirds);

JLabel lblNewLabel_1 = new JLabel("<html><div style='text-align: LEFT'>The story follows Gab, a


responsible and organized woman engaged to her long-time boyfriend, Jason. Her life takes an
unexpected turn when she discovers that she is already legally married to Dos, a carefree and
adventurous guy, due to a drunken mistake in Las Vegas. As they work together to annul their
accidental marriage, they face various comedic situations and challenges, eventually developing
feelings for each other. Gab must then decide between staying with Dos or marrying Jason, the man
she initially planned to spend her life with\u200B ");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setVerticalAlignment(SwingConstants.TOP);

lblNewLabel_1.setBounds(630, 130, 435, 311);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel = new JLabel("DESCRIPTION:");

lblNewLabel.setForeground(new Color(0, 0, 0));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel.setBounds(630, 97, 162, 25);

f.getContentPane().add(lblNewLabel);

JLabel lblTitle = new JLabel("TITLE: ");

lblTitle.setForeground(new Color(0, 0, 0));


lblTitle.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblTitle.setBounds(35, 475, 76, 13);

f.getContentPane().add(lblTitle);

JLabel lblPrice = new JLabel("PRICE: \u20B1 190 ");

lblPrice.setForeground(new Color(0, 0, 0));

lblPrice.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblPrice.setBounds(35, 580, 162, 13);

f.getContentPane().add(lblPrice);

JLabel lblGenre = new JLabel("GENRE:");

lblGenre.setForeground(new Color(0, 0, 0));

lblGenre.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblGenre.setBounds(35, 508, 76, 13);

f.getContentPane().add(lblGenre);

JLabel lblDuration = new JLabel("DURATION:");

lblDuration.setForeground(new Color(0, 0, 0));

lblDuration.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 15));

lblDuration.setBounds(35, 544, 90, 13);

f.getContentPane().add(lblDuration);

JLabel pictureLabel1 = new JLabel();

pictureLabel1.setBounds(35, 80, 562, 361); // Set desired bounds

ImageIcon imageIcon1 = new ImageIcon(getClass().getResource("/romance5.jpg"));

pictureLabel1.setIcon(new
ImageIcon(imageIcon1.getImage().getScaledInstance(pictureLabel1.getWidth(),
pictureLabel1.getHeight(), Image.SCALE_SMOOTH)));

f.getContentPane().add(pictureLabel1);

JLabel lblCinemasaya = new JLabel("Cinemasaya");

lblCinemasaya.setForeground(new Color(0, 0, 0));


lblCinemasaya.setFont(new Font("Cooper Black", Font.BOLD | Font.ITALIC, 29));

lblCinemasaya.setBounds(30, 17, 242, 60);

f.getContentPane().add(lblCinemasaya);

JButton btnNewButton = new JButton("RENT NOW!");

btnNewButton.addActionListener(this);

btnNewButton.setFont(new Font("Tempus Sans ITC", Font.BOLD, 22));

btnNewButton.setForeground(new Color(0, 0, 0));

btnNewButton.setBounds(740, 555, 212, 49);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int response = JOptionPane.showConfirmDialog(f, "Are you sure you want to rent this
movie?", "CONFIRMATION", JOptionPane.YES_NO_OPTION);

if (response == JOptionPane.YES_OPTION) {

String title = lblTheAngryBirds.getText().replace("TITLE: ", "").trim();

String price = lblPrice.getText().replace("PRICE: \u20B1", "").trim();

try {

// Load the JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

// Establish the connection

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL query

String sql = "INSERT INTO test(Username, user_title, user_price) VALUES (?, ?, ?)";

PreparedStatement pst = conn.prepareStatement(sql);

// Set the parameters

pst.setString(1, username); // Assuming 'username' is initialized and available


pst.setString(2, title);

pst.setString(3, price);

// Execute the query

int rowsAffected = pst.executeUpdate();

// Check if the insertion was successful

if (rowsAffected > 0) {

JOptionPane.showMessageDialog(null, "Record Added!");

lblTheAngryBirds.setText("TITLE: ");

lblPrice.setText("PRICE: ");

// Open the library frame

JFrame libraryFrame = createLibraryFrame(username);

libraryFrame.setVisible(true);

f.dispose();

} else {

JOptionPane.showMessageDialog(null, "Record Not Added. Please try again.");

// Clear the input fields

lblTheAngryBirds.setText("");

lblPrice.setText("");

// Close resources

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {


// Print stack trace for debugging

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

});

f.getContentPane().add(btnNewButton);

JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(1000, 13, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createRomanceFrame(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1);

JLabel backgroundLabel = new JLabel(backgroundImage);

backgroundLabel.setBounds(0, 0, 1086, 663);

f.getContentPane().add(backgroundLabel);

JLabel label = new JLabel("New label");

label.setBounds(54, 31, 45, 13);

f.getContentPane().add(label);
return f;

private JFrame createDetailsframe(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(600, 600);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

Image frontImage = new


ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();

JButton btnX = new JButton("<");

btnX.setFont(new Font("Times New Roman", Font.BOLD, 12));

btnX.setBounds(531, 10, 45, 38);

btnX.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createMoviesframe(username);

moviesFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnX);
int userId = getUserId(username);

JLabel lblNewLabel_1 = new JLabel("CINEMASAYA");

lblNewLabel_1.setFont(new Font("Showcard Gothic", Font.BOLD | Font.ITALIC, 30));

lblNewLabel_1.setForeground(new Color(255, 255, 255));

lblNewLabel_1.setBounds(188, 10, 232, 59);

f.getContentPane().add(lblNewLabel_1);

JLabel lblNewLabel_2_1 = new JLabel("UID: " + userId);

lblNewLabel_2_1.setForeground(Color.WHITE);

lblNewLabel_2_1.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblNewLabel_2_1.setBounds(137, 161, 128, 25);

f.getContentPane().add(lblNewLabel_2_1);

JButton btnLogOut = new JButton("LOG OUT ");

btnLogOut.setFont(new Font("Times New Roman", Font.BOLD, 12));

btnLogOut.setBounds(224, 347, 128, 48);

btnLogOut.addActionListener(e1 -> backLogin(f));

f.getContentPane().add(btnLogOut);

JButton btnNewButton = new JButton("ACCOUNT DETAILS");

btnNewButton.setFont(new Font("Times New Roman", Font.BOLD, 12));

btnNewButton.setBounds(212, 242, 156, 48);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame accountFrame = createAccountFrame(username);

accountFrame.setVisible(true);

f.dispose();

});
f.getContentPane().add(btnNewButton);

JLabel lblNewLabel_2 = new JLabel("Username: " + username);

lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 25));

lblNewLabel_2.setForeground(new Color(255, 255, 255));

lblNewLabel_2.setBounds(137, 137, 250, 25);

f.getContentPane().add(lblNewLabel_2);

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(0, 0, 598, 674);

f.getContentPane().add(frontLabel);

JLabel lblNewLabel = new JLabel("New label");

lblNewLabel.setBounds(202, 55, 45, 13);

f.getContentPane().add(lblNewLabel);

f.dispose();

return f;

}
private int getUserId(String username) {

int userId = -1;

String sql = "SELECT id FROM server1 WHERE username = ?";

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

PreparedStatement pstmt = conn.prepareStatement(sql); {

pstmt.setString(1, username);

ResultSet rs = pstmt.executeQuery();

if (rs.next()) {

userId = rs.getInt("id");

} catch (SQLException | ClassNotFoundException ex) {

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

return userId;

private Object[][] fetchData(String username) {

Object[][] data = null;

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");
// Create a scrollable ResultSet

String sql = "SELECT Username, user_title, user_price


FROM test WHERE Username = ?";

PreparedStatement pst = conn.prepareStatement(sql,


ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

pst.setString(1, username);

ResultSet rs = pst.executeQuery();

rs.last();

int rowCount = rs.getRow();

rs.beforeFirst();

data = new Object[rowCount][3];

int i = 0;

while (rs.next()) {

data[i][0] = rs.getString("user_title");

data[i][1] = rs.getString("user_price");

i++;

rs.close();

pst.close();

conn.close();

} catch (SQLException | ClassNotFoundException ex) {

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " +


ex.getMessage());

return data;

}
private JFrame createLibraryFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(795, 769);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

// Create a layered pane

JLayeredPane layeredPane = new JLayeredPane();

layeredPane.setBounds(0, 0, 795, 769);

f.getContentPane().add(layeredPane);

String[] columnNames = { "Title", "Price"};

Object[][] data = fetchData(username);

JTable table = new JTable(data, columnNames);

JScrollPane scrollPane = new JScrollPane(table);

scrollPane.setBounds(50, 100, 700, 500);

layeredPane.add(scrollPane, Integer.valueOf(1));

// Add other components like buttons to the layered pane

JButton btnMovies_1_1 = new JButton("LIBRARY");

btnMovies_1_1.setBackground(Color.WHITE);

btnMovies_1_1.setFont(new Font("Tahoma", Font.BOLD, 20));

btnMovies_1_1.setBounds(200, 640, 150, 42);

layeredPane.add(btnMovies_1_1, Integer.valueOf(1));
JButton btnMovies_1_2 = new JButton("HOME");

btnMovies_1_2.setFont(new Font("Tahoma", Font.BOLD, 20));

btnMovies_1_2.setBounds(460, 640, 150, 42);

btnMovies_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame MoviesFrame = createMoviesframe(username);

MoviesFrame.setVisible(true);

f.dispose();

});

layeredPane.add(btnMovies_1_2, Integer.valueOf(1));

JLabel lblNewLabel_2_2 = new JLabel("Library");

lblNewLabel_2_2.setForeground(Color.WHITE);

lblNewLabel_2_2.setFont(new Font("Tahoma", Font.BOLD, 40));

lblNewLabel_2_2.setBounds(314, 10, 231, 46);

layeredPane.add(lblNewLabel_2_2, Integer.valueOf(1));

// Load the background image

JLabel backgroundLabel = new JLabel();

backgroundLabel.setIcon(new ImageIcon(new
ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage().getScaledInstance(795, 769,
Image.SCALE_SMOOTH)));

backgroundLabel.setBounds(0, 0, 795, 769);

layeredPane.add(backgroundLabel,
Integer.valueOf(0)); // Add the background label to the lowest layer
return f;

private JFrame createAccountFrame(String username) {

JFrame f = new JFrame("Account Details");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(635, 436);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

try {

// Load the MySQL JDBC driver

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

// Prepare the SQL statement

String sql = "SELECT * FROM server1 WHERE username = ?";

PreparedStatement stmt = conn.prepareStatement(sql);

stmt.setString(1, username);

// Execute the query

ResultSet rs = stmt.executeQuery();

// Process the result set


if (rs.next()) {

String email = rs.getString("user_email");

String fname = rs.getString("user_firstname");

String mname = rs.getString("user_middlename");

String lname = rs.getString("user_lastname");

String birthdateDay = rs.getString("birthdate_day");

String birthdateMonth = rs.getString("birthdate_month");

String birthdateYear = rs.getString("birthdate_year");

String age = rs.getString("age");

// Populate JLabels with retrieved information

JLabel lblAge = new JLabel("Age: " +" " + age);

lblAge.setForeground(Color.WHITE);

lblAge.setFont(new Font("Tahoma", Font.BOLD, 20));

lblAge.setBounds(77, 341, 500, 25);

JLabel lblFirstName = new JLabel("First Name: " + " " + fname);

lblFirstName.setForeground(Color.WHITE);

lblFirstName.setFont(new Font("Tahoma", Font.BOLD, 20));

lblFirstName.setBounds(77, 201, 500, 25);

JLabel lblLastName = new JLabel("Last Name: " + " " + lname);

lblLastName.setForeground(Color.WHITE);

lblLastName.setFont(new Font("Tahoma", Font.BOLD, 20));

lblLastName.setBounds(77, 271, 500, 25);

JLabel lblBirthdate = new JLabel("Birth Date: " + " " + birthdateDay + " " +
birthdateMonth + ", " + birthdateYear);

lblBirthdate.setForeground(Color.WHITE);

lblBirthdate.setFont(new Font("Tahoma", Font.BOLD, 20));

lblBirthdate.setBounds(77, 306, 500, 25);


JLabel lblMiddleName = new JLabel("Middle Name: " + " " + mname);

lblMiddleName.setForeground(Color.WHITE);

lblMiddleName.setFont(new Font("Tahoma", Font.BOLD, 20));

lblMiddleName.setBounds(77, 236, 500, 25);

JLabel lblEmail = new JLabel("Email: " + " " + email);

lblEmail.setForeground(Color.WHITE);

lblEmail.setFont(new Font("Tahoma", Font.BOLD, 20));

lblEmail.setBounds(77, 131, 500, 25);

// Add JLabels to the frame

f.getContentPane().add(lblAge);

f.getContentPane().add(lblFirstName);

f.getContentPane().add(lblLastName);

f.getContentPane().add(lblBirthdate);

f.getContentPane().add(lblMiddleName);

f.getContentPane().add(lblEmail);

} else {

// Handle case where user is not found in the database

JOptionPane.showMessageDialog(null, "User not found!");

// Close resources

rs.close();

stmt.close();

conn.close();

} catch (SQLException | ClassNotFoundException e) {

e.printStackTrace();

JOptionPane.showMessageDialog(null, e);

}
JButton btnNewButton_1 = new JButton("<");

btnNewButton_1.setBounds(535, 10, 65, 37);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

// Call the method to create the registration frame

JFrame moviesFrame = createDetailsframe(username);

moviesFrame.setVisible(true);

f.dispose();

});

JLabel lblNewLabel = new JLabel("ACCOUNT DETAILS");

lblNewLabel.setForeground(new Color(255, 255, 255));

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 35));

lblNewLabel.setBounds(133, 27, 417, 49);

f.getContentPane().add(lblNewLabel);

f.getContentPane().add(btnNewButton_1);

// Add image to the frame

Image frontImage = new ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(0, 0, 796, 747);

f.getContentPane().add(frontLabel);

return f;

}
private JFrame createDashboardFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(614, 373);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

Image frontImage = new


ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();

JButton btnNewButton_1 = new JButton("Total User");

btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 20));

btnNewButton_1.setBounds(102, 130, 145, 76);

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame TotaluserFrame = createTotaluserFrame(username);

TotaluserFrame.setVisible(true);

f.dispose();

});
f.getContentPane().add(btnNewButton_1);

JButton btnNewButton_1_2 = new JButton("Transaction");

btnNewButton_1_2.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 18));

btnNewButton_1_2.setBounds(330, 131, 145, 76);

btnNewButton_1_2.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame TransactionFrame = createTransactionFrame(username);

TransactionFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton_1_2);

JLabel lblNewLabel_2_2 = new JLabel("ADMIN DASHBOARD");

lblNewLabel_2_2.setForeground(Color.WHITE);

lblNewLabel_2_2.setFont(new Font("Tahoma", Font.BOLD, 40));

lblNewLabel_2_2.setBounds(107, 26, 439, 46);

f.getContentPane().add(lblNewLabel_2_2);

JLabel lblNewLabel = new JLabel("New label");

lblNewLabel.setBounds(202, 55, 45, 13);

f.getContentPane().add(lblNewLabel);

JButton btnLogOut = new JButton("LOG OUT ");

btnLogOut.setBackground(new Color(255, 128, 128));

btnLogOut.setFont(new Font("Times New Roman", Font.BOLD, 12));

btnLogOut.setBounds(480, 295, 95, 31);


btnLogOut.addActionListener(e1 -> backLogin(f));

f.getContentPane().add(btnLogOut);

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(0, -8, 610, 396);

f.getContentPane().add(frontLabel);

return f;

private JFrame createTotaluserFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(614, 597);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);
Image frontImage = new
ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();

String[] columnNames = {"ID", "Username", "First Name", "Middle Name", "Last Name"};

DefaultTableModel model = new DefaultTableModel(columnNames, 0);

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

String sql = "SELECT id, username, user_firstname, user_middlename, user_lastname


FROM server1";

PreparedStatement pstmt = conn.prepareStatement(sql);

ResultSet rs = pstmt.executeQuery();

while (rs.next()) {

int id = rs.getInt("id");

String user = rs.getString("username");

String firstName = rs.getString("user_firstname");

String middleName = rs.getString("user_middlename");

String lastName = rs.getString("user_lastname");

model.addRow(new Object[]{id, user, firstName, middleName, lastName});

} catch (SQLException | ClassNotFoundException ex) {

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

JTable table = new JTable(model);

JScrollPane scrollPane = new JScrollPane(table);

scrollPane.setBounds(0, 105, 600, 463);

f.getContentPane().add(scrollPane);
JLabel lblNewLabel_2_3_1_4_2 = new JLabel("Rent Movies");

lblNewLabel_2_3_1_4_2.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_2.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_2.setBounds(319, 139, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_2);

JButton btnNewButton = new JButton("<");

btnNewButton.setBounds(519, 22, 61, 25);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame DashboardFrame = createDashboardFrame(username);

DashboardFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton);

JLabel lblNewLabel_2_2 = new JLabel("TOTAL USER");

lblNewLabel_2_2.setForeground(Color.WHITE);

lblNewLabel_2_2.setFont(new Font("Tahoma", Font.BOLD, 40));

lblNewLabel_2_2.setBounds(180, 22, 329, 46);

f.getContentPane().add(lblNewLabel_2_2);

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));


frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(0, -23, 600, 591);

f.getContentPane().add(frontLabel);

JLabel lblNewLabel = new JLabel("New label");

lblNewLabel.setBounds(202, 55, 45, 13);

f.getContentPane().add(lblNewLabel);

JSeparator separator_2_2 = new JSeparator();

separator_2_2.setBounds(78, 174, 532, 66);

f.getContentPane().add(separator_2_2);

f.dispose();

return f;

private JFrame createTransactionFrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(826, 597);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

Image frontImage = new


ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();
String[] columnNames = {"Username", "user_title", "user_price"};

DefaultTableModel model = new DefaultTableModel(columnNames, 0);

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

String sql = "SELECT username, user_title, user_price FROM test";

PreparedStatement pstmt = conn.prepareStatement(sql);

ResultSet rs = pstmt.executeQuery();

while (rs.next()) {

String user = rs.getString("username");

String title = rs.getString("user_title");

String price = rs.getString("user_price");

model.addRow(new Object[]{user, title, price});

} catch (SQLException | ClassNotFoundException ex) {

ex.printStackTrace();

JOptionPane.showMessageDialog(null, "Error: " + ex.getMessage());

JTable table = new JTable(model);

JScrollPane scrollPane = new JScrollPane(table);

scrollPane.setBounds(0, 97, 817, 463);

f.getContentPane().add(scrollPane);

JButton btnNewButton = new JButton("<");


btnNewButton.setBounds(741, 24, 61, 25);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame DashboardFrame = createDashboardFrame(username);

DashboardFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton);

JLabel lblNewLabel_2_2 = new JLabel("Transaction");

lblNewLabel_2_2.setForeground(Color.WHITE);

lblNewLabel_2_2.setFont(new Font("Tahoma", Font.BOLD, 40));

lblNewLabel_2_2.setBounds(284, 24, 301, 46);

f.getContentPane().add(lblNewLabel_2_2);

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(-11, 0, 1072, 601);

f.getContentPane().add(frontLabel);

JLabel lblNewLabel = new JLabel("New label");

lblNewLabel.setBounds(202, 55, 45, 13);

f.getContentPane().add(lblNewLabel);

JSeparator separator_2_2 = new JSeparator();


separator_2_2.setBounds(78, 174, 739, 66);

f.getContentPane().add(separator_2_2);

f.dispose();

return f;

JFrame createRentrame(String username) {

JFrame f = new JFrame("CINEMASAYA");

f.getContentPane().setBackground(Color.BLACK);

f.setSize(650, 597);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.getContentPane().setLayout(null);

f.setResizable(false);

f.setLocationRelativeTo(null);

Image frontImage = new


ImageIcon(this.getClass().getResource("/MENU.jpg")).getImage();

JLabel lblNewLabel_2_3_1_4_1_1_5_1 = new JLabel("7.");

lblNewLabel_2_3_1_4_1_1_5_1.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_5_1.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_5_1.setBounds(10, 408, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_5_1);

JLabel lblNewLabel_2_3_1_4_1_1_5_4 = new JLabel("10.");


lblNewLabel_2_3_1_4_1_1_5_4.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_5_4.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_5_4.setBounds(10, 510, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_5_4);

JLabel lblNewLabel_2_3_1_4_1_1_5_3 = new JLabel("9.");

lblNewLabel_2_3_1_4_1_1_5_3.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_5_3.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_5_3.setBounds(10, 474, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_5_3);

JLabel lblNewLabel_2_3_1_4_1_1_5_2 = new JLabel("8.");

lblNewLabel_2_3_1_4_1_1_5_2.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_5_2.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_5_2.setBounds(10, 442, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_5_2);

JSeparator separator_2_3_2 = new JSeparator();

separator_2_3_2.setBounds(0, 397, 817, 25);

f.getContentPane().add(separator_2_3_2);

JLabel lblNewLabel_2_3_1_4_1_1_5 = new JLabel("6.");

lblNewLabel_2_3_1_4_1_1_5.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_5.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_5.setBounds(10, 375, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_5);

JSeparator separator_1 = new JSeparator();

separator_1.setOrientation(SwingConstants.VERTICAL);

separator_1.setBounds(479, 139, 45, 553);

f.getContentPane().add(separator_1);
JSeparator separator_1_1 = new JSeparator();

separator_1_1.setOrientation(SwingConstants.VERTICAL);

separator_1_1.setBounds(642, 139, 45, 553);

f.getContentPane().add(separator_1_1);

JSeparator separator_2_3_5 = new JSeparator();

separator_2_3_5.setBounds(0, 499, 817, 18);

f.getContentPane().add(separator_2_3_5);

JSeparator separator_2_3_3 = new JSeparator();

separator_2_3_3.setBounds(0, 431, 817, 18);

f.getContentPane().add(separator_2_3_3);

JLabel lblNewLabel_2_3_1_4_2_2 = new JLabel("Price");

lblNewLabel_2_3_1_4_2_2.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_2_2.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_2_2.setBounds(524, 139, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_2_2);

JLabel lblNewLabel_2_3_1_4_1_1_4 = new JLabel("5.");

lblNewLabel_2_3_1_4_1_1_4.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_4.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_4.setBounds(10, 340, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_4);

JLabel lblNewLabel_2_3_1_4_1_1_3 = new JLabel("4.");

lblNewLabel_2_3_1_4_1_1_3.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_3.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_3.setBounds(10, 305, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_3);
JLabel lblNewLabel_2_3_1_4_1_1_2 = new JLabel("3.");

lblNewLabel_2_3_1_4_1_1_2.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_2.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_2.setBounds(10, 265, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_2);

JLabel lblNewLabel_2_3_1_4_1_1_1 = new JLabel("2.");

lblNewLabel_2_3_1_4_1_1_1.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1_1.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1_1.setBounds(10, 230, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1_1);

JLabel lblNewLabel_2_3_1_4_1_1 = new JLabel("1.");

lblNewLabel_2_3_1_4_1_1.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1_1.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1_1.setBounds(10, 185, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1_1);

JSeparator separator_2_3_4 = new JSeparator();

separator_2_3_4.setBounds(0, 464, 817, 18);

f.getContentPane().add(separator_2_3_4);

JSeparator separator_2_3_1 = new JSeparator();

separator_2_3_1.setBounds(0, 364, 817, 25);

f.getContentPane().add(separator_2_3_1);

JSeparator separator_2_3_6 = new JSeparator();

separator_2_3_6.setBounds(0, 532, 817, 36);

f.getContentPane().add(separator_2_3_6);
JSeparator separator = new JSeparator();

separator.setOrientation(SwingConstants.VERTICAL);

separator.setBounds(250, 139, 128, 553);

f.getContentPane().add(separator);

JSeparator separator_2_1 = new JSeparator();

separator_2_1.setBounds(0, 174, 817, 18);

f.getContentPane().add(separator_2_1);

JSeparator separator_2_4 = new JSeparator();

separator_2_4.setBounds(0, 260, 817, 18);

f.getContentPane().add(separator_2_4);

JSeparator separator_2 = new JSeparator();

separator_2.setBounds(0, 220, 817, 18);

f.getContentPane().add(separator_2);

JSeparator separator_2_5 = new JSeparator();

separator_2_5.setBounds(0, 296, 817, 23);

f.getContentPane().add(separator_2_5);

JSeparator separator_2_3 = new JSeparator();

separator_2_3.setBounds(0, 329, 817, 18);

f.getContentPane().add(separator_2_3);

JLabel lblNewLabel_2_3_1_4_1 = new JLabel("Movie Title");

lblNewLabel_2_3_1_4_1.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_1.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_1.setBounds(58, 139, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_1);
JLabel lblNewLabel_2_3_1_4_2 = new JLabel("Movie Title");

lblNewLabel_2_3_1_4_2.setForeground(Color.WHITE);

lblNewLabel_2_3_1_4_2.setFont(new Font("Tahoma", Font.BOLD, 20));

lblNewLabel_2_3_1_4_2.setBounds(304, 139, 128, 25);

f.getContentPane().add(lblNewLabel_2_3_1_4_2);

JButton btnNewButton = new JButton("<");

btnNewButton.setBounds(560, 43, 61, 25);

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

JFrame DashboardFrame = createDashboardFrame(username);

DashboardFrame.setVisible(true);

f.dispose();

});

f.getContentPane().add(btnNewButton);

JLabel lblNewLabel_2_2 = new JLabel("Rental Movies");

lblNewLabel_2_2.setForeground(Color.WHITE);

lblNewLabel_2_2.setFont(new Font("Tahoma", Font.BOLD, 40));

lblNewLabel_2_2.setBounds(168, 20, 301, 46);

f.getContentPane().add(lblNewLabel_2_2);

JLabel frontLabel = new JLabel("");

frontLabel.setBackground(new Color(0, 0, 0));

frontLabel.setForeground(new Color(0, 0, 0));

frontLabel.setIcon(new ImageIcon(frontImage));

frontLabel.setBounds(-11, 0, 1072, 601);


f.getContentPane().add(frontLabel);

JLabel lblNewLabel = new JLabel("New label");

lblNewLabel.setBounds(202, 55, 45, 13);

f.getContentPane().add(lblNewLabel);

JSeparator separator_2_2 = new JSeparator();

separator_2_2.setBounds(78, 174, 739, 66);

f.getContentPane().add(separator_2_2);

f.dispose();

return f;

private ImageIcon resizeImageIcon(ImageIcon originalIcon) {

Image originalImage = originalIcon.getImage();

Image resizedImage = originalImage.getScaledInstance(IMAGE_WIDTH, IMAGE_HEIGHT,


Image.SCALE_SMOOTH);

return new ImageIcon(resizedImage);

private String hashPassword(String password) {

try {

MessageDigest md = MessageDigest.getInstance("SHA-256");

byte[] hashBytes = md.digest(password.getBytes());

StringBuilder sb = new StringBuilder();

for (byte b : hashBytes) {

sb.append(String.format("%02x", b));
}

return sb.toString();

} catch (NoSuchAlgorithmException e) {

e.printStackTrace();

return null;

private void searchMovie(String searchQuery, String username , JFrame parentFrame ) {

if (searchQuery.equalsIgnoreCase("THE ANGRY BIRDS")) {

JFrame rentFrame = createRentFrame(username);

rentFrame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("TROLLS")) {

JFrame rent1Frame = createRent2Frame(username);

rent1Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("WRECK-IT RALPH")) {

JFrame rent3Frame = createRent3Frame(username);

rent3Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("RATATOUILLE")) {

JFrame rent4Frame = createRent4Frame(username);

rent4Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("CHARLIE CHAPLIN")) {

JFrame rent11Frame = createRent11Frame(username);

rent11Frame.setVisible(true);

parentFrame.dispose();
} else if (searchQuery.equalsIgnoreCase("HOME ALONE")) {

JFrame rent12Frame = createRent12Frame(username);

rent12Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("BILLY MADISON")) {

JFrame rent13Frame = createRent13Frame(username);

rent13Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("MR. BEAN'S HOLIDAY")) {

JFrame rent14Frame = createRent14Frame(username);

rent14Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("THE NUN")) {

JFrame rent21Frame = createRent21Frame(username);

rent21Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("TALK TO ME")) {

JFrame rent22Frame = createRent22Frame(username);

rent22Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("MINNIE THE POOH")) {

JFrame rent23Frame = createRent23Frame(username);

rent23Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("THE CONJURING")) {

JFrame rent24Frame = createRent24Frame(username);

rent24Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("ONE DAY")) {


JFrame rent31Frame = createRent31Frame(username);

rent31Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("THE FAULT IN OUR STARS")) {

JFrame rent32Frame = createRent32Frame(username);

rent32Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("THE NOTEBOOK")) {

JFrame rent33Frame = createRent33Frame(username);

rent33Frame.setVisible(true);

parentFrame.dispose();

} else if (searchQuery.equalsIgnoreCase("CAN'T HELP FALLING IN LOVE")) {

JFrame rent34Frame = createRent34Frame(username);

rent34Frame.setVisible(true);

parentFrame.dispose();

} else {

JOptionPane.showMessageDialog(parentFrame, "Movie not found");

private void authenticateUser(String username, String password, String userType, JFrame


loginFrame) {

try {

Class.forName("com.mysql.cj.jdbc.Driver");

Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/your_database_name", "root", "");

String sql = "SELECT * FROM server1 WHERE Username=? AND UserType=?";

PreparedStatement pstmt = con.prepareStatement(sql);

pstmt.setString(1, username);

pstmt.setString(2, userType);
ResultSet rs = pstmt.executeQuery();

if (rs.next()) {

String userTypeFromDB = rs.getString("UserType");

String hashedPasswordFromDB = rs.getString("Password");

// Check if the user type is ADMIN

if ("ADMIN".equals(userTypeFromDB)) {

// No need to hash password for admin

if (password.equals(hashedPasswordFromDB)) {

JOptionPane.showMessageDialog(null, "Log in successful as " + userType);

JFrame dashboardFrame = createDashboardFrame(username);

dashboardFrame.setVisible(true);

loginFrame.dispose();

} else {

JOptionPane.showMessageDialog(null, "Incorrect password for admin");

} else {

// Hash password for client

String hashedPassword = hashPassword(password);

if (hashedPasswordFromDB.equals(hashedPassword)) {

JOptionPane.showMessageDialog(null, "Log in successful as " + userType);

JFrame moviesFrame = createMoviesframe(username);

moviesFrame.setVisible(true);

loginFrame.dispose();

} else {

JOptionPane.showMessageDialog(null, "Incorrect password or user type");

} else {
JOptionPane.showMessageDialog(null, "User not found");

con.close();

} catch (Exception e) {

e.printStackTrace();

private void showMoviesFrame(String username) {

linesFrame = createMoviesframe(username);

loginFrame.setVisible(false);

linesFrame.setVisible(true);

private void backLogin(JFrame frameToClose) {

frameToClose.dispose();

loginFrame.setVisible(true);

private ImageIcon ImageIcon(URL resource) {

// TODO Auto-generated method stub

return null;

@Override

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub


}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy