You are on page 1of 62

import java.sql.

*;

import java.util.Date;

import java.io.*;

import java.util.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.*;

import java.text.*;

import javax.swing.text.*;

import javax.swing.table.*;

import javax.sql.rowset.*;

import com.sun.rowset.*;

import java.awt.print.*;

import java.lang.String.*;

////////////////////////////////////////
HOMEPAGE ///////////////////////////////////////////////////////////////////////////

class homepage extends JFrame implements


ActionListener,WindowListener,ComponentListener,FocusListener

JLabel l,l1,l2,l3,l4,l5,l6,l7,l8,l9,l67;

JButton next,abort;

Container c;
JFrame f;

homepage()

super("HOME PAGE");

c = getContentPane();

c.setLayout(null);

addWindowListener(this);

l1= new JLabel("Movie Ticket Managment ");

l1.setFont(new Font("Dialog", Font.ITALIC+Font.BOLD, 70));

l1.setForeground(Color.red);

l1.setBounds(130,20,1000,100);

c.add(l1);

l= new JLabel(" System");

l.setFont(new Font("Dialog", Font.ITALIC+Font.BOLD, 70));

l.setForeground(Color.RED);

l.setBounds(350,100,1100,120);

c.add(l);

ImageIcon proj = new ImageIcon("g.jpg");

JLabel jlpro = new JLabel("", proj, JLabel.CENTER);

jlpro.setBounds(50,110,179,144);
c.add(jlpro);

l8= new JLabel("Created by :-");

l8.setFont(new Font("Dialog", Font.ITALIC, 50));

l8.setForeground(Color.white);

l8.setBounds(400,200,1100,120);

c.add(l8);

l3= new JLabel("Swapnil Mahale &");

l3.setFont(new Font("Dialog", Font.ITALIC+Font.CENTER_BASELINE, 40));

l3.setForeground(new Color(0,166,0));

l3.setBounds(500,270,1000,100);

c.add(l3);

l4= new JLabel(" Kuldeep Badalia");

l4.setFont(new Font("Dialog", Font.ITALIC+Font.CENTER_BASELINE, 40));

l4.setForeground(new Color(0,166,0));

l4.setBounds(550,330,1000,100);

c.add(l4);

l9= new JLabel(" Of ");

l9.setFont(new Font("CAMBRIA", Font.BOLD+Font.ITALIC, 50));

l9.setForeground(Color.white);

l9.setBounds(350,400,1000,100);
c.add(l9);

l5= new JLabel("H.A.L. COLLEGE ");

l5.setFont(new Font("Dialog", Font.ITALIC+Font.BOLD, 50));

l5.setForeground(new Color(0,166,0));

l5.setBounds(100,480,1000,100);

c.add(l5);

l6= new JLabel(" Click Next to Continue or Abort to Exit");

l6.setFont(new Font("ARIAL", Font.PLAIN, 35));

l6.setForeground(Color.white);

l6.setBounds(150,650,1000,100);

c.add(l6);

next = new JButton("Next");

next.setBorder(new LineBorder(Color.red));

next.setMnemonic('n');

next.setBounds(350,600,100,50);

next.setForeground(Color.black);

next.setToolTipText("Go to next page");

next.setFont(new Font("high tower text", Font.BOLD,20));

next.addActionListener(this);

c.add(next);

abort = new JButton("Abort");


abort.setBorder(new LineBorder(Color.red));

abort.setMnemonic('a');

abort.setBounds(550,600,100,50);

abort.setForeground(Color.black);

abort.setToolTipText("Exit From Software");

abort.setFont(new Font("high tower text", Font.BOLD,20));

abort.addActionListener(this);

c.add(abort);

c.setBackground( Color.black);

setSize(Toolkit.getDefaultToolkit().getScreenSize());

show();

setVisible(true);

public void windowOpened(WindowEvent w1) { }

public void windowClosed(WindowEvent w1) { }

public void windowClosing(WindowEvent w1)

System.exit(0);

public void windowActivated(WindowEvent w1) { }

public void windowDeactivated(WindowEvent w1) { }

public void windowIconified(WindowEvent w1) { }

public void windowDeiconified(WindowEvent w1) { }


public void componentResized(ComponentEvent c1)

public void componentMoved(ComponentEvent c1) { }

public void componentShown(ComponentEvent c1) { }

public void componentHidden(ComponentEvent c1) { }

public void actionPerformed(ActionEvent a1)

String s1 = a1.getActionCommand();

if(s1.equals("Abort"))

String s = "Are you sure want to Quit?";

int j = JOptionPane.showConfirmDialog(this,s,"Movie Show Ticket


Management",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);

if(j == JOptionPane.YES_OPTION)

System.exit(0);

if(j == JOptionPane.NO_OPTION)

else
{

setVisible(false);

mainchoice m1 = new mainchoice();

public void focusGained(FocusEvent ev)

/*JButton jb = (JButton)ev.getComponent();

if(jb==next)

c.setBackground(Color.cyan);

next.setBackground(Color.red);

else

abort.setBackground(Color.red);*/

public void focusLost(FocusEvent ev)

{ }

///////////////////////////////////////
MAINCHOICE ///////////////////////////////////////////////////////////////////

class mainchoice extends JFrame implements ActionListener

JLabel l1,jldate;
JRadioButton book,ac;

ButtonGroup bg;

JButton next,back,set;

mainchoice()

super(" Main Choice Page ");

Container c = getContentPane();

c.setLayout(null);

jldate = new JLabel("Date : ");

jldate.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,30));

jldate.setForeground(Color.red);

jldate.setBounds(650,20,230,45);

c.add(jldate);

Date d=new Date();

JTextField jtfdate = new JTextField();

DateFormat fmt = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);

jtfdate.setBounds(730,20,240,35);

jtfdate.setEditable(false);

String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.PLAIN,30));

jtfdate.setText(dt);

c.add(jtfdate);
l1 = new JLabel("Choose Requiered Option From Below:");

l1.setBorder(new LineBorder(Color.red));

l1.setFont(new Font("Cooper Black", Font.BOLD, 45));

l1.setForeground(Color.yellow);

l1.setBounds(5,150,1000,150);

c.add(l1);

ImageIcon proj = new ImageIcon("w1.jpg");

JLabel jlpro = new JLabel("", proj, JLabel.CENTER);

jlpro.setBounds(100,400,179,144);

c.add(jlpro);

ImageIcon proj1 = new ImageIcon("c.jpg");

JLabel jlpro1 = new JLabel("", proj1, JLabel.CENTER);

jlpro1.setBounds(300,400,179,144);

c.add(jlpro1);

ImageIcon proj3 = new ImageIcon("a.jpg");

JLabel jlpro3 = new JLabel("", proj3, JLabel.CENTER);

jlpro3.setBounds(500,400,179,144);

c.add(jlpro3);

ImageIcon proj2 = new ImageIcon("s.jpg");

JLabel jlpro2 = new JLabel("", proj2, JLabel.CENTER);


jlpro2.setBounds(700,400,179,144);

c.add(jlpro2);

next = new JButton("Booking");

next.setBorder(new LineBorder(Color.red));

next.setToolTipText("For booking tickets");

next.setMnemonic('b');

next.setBounds(150,650,150,50);

next.setForeground(Color.black);

next.setFont(new Font("Times New Roman",Font.BOLD,28));

next.addActionListener(this);

c.add(next);

set = new JButton("Settings");

set.setBorder(new LineBorder(Color.red));

set.setToolTipText("To add movie & distributer details");

set.setMnemonic('s');

set.setBounds(450,650,150,50);

set.setForeground(Color.black);

set.setFont(new Font("Times New Roman",Font.BOLD,28));

set.addActionListener(this);

c.add(set);
back = new JButton("Back");

back.setBorder(new LineBorder(Color.red));

back.setToolTipText("Go to first page");

back.setMnemonic('c');

back.setBounds(750,650,150,50);

back.setForeground(Color.black);

back.setFont(new Font("Times New Roman",Font.BOLD,28));

back.addActionListener(this);

c.add(back);

c.setBackground(Color.black);

setSize(Toolkit.getDefaultToolkit().getScreenSize());

show();

setVisible(true);

public void actionPerformed(ActionEvent a1)

String s1 = a1.getActionCommand();

if(s1.equals("Back"))

setVisible(false);

new homepage().setVisible(true);
}

if(s1.equals("Booking"))

setVisible(false);

new pass1().setVisible(true);

if(s1.equals("Settings"))

setVisible(false);

new pass2().setVisible(true);

////////////////////////////////////// FOR BOOKING


PASSWORD /////////////////////////////////////////////////////////////////////////////

class pass1 extends JFrame implements ActionListener

JTextField jtfname;

JPasswordField jtfpass;

JLabel jlno,jlpass,jldate,mes,l4;

JButton ok,clear,cancel;
Container c;

Connection c1;

Statement st1;

ResultSet rs1 ;

pass1()

super(" Login Screen ");

c = getContentPane();

c.setLayout(null);

jldate = new JLabel("Date :");

jldate.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,16));

jldate.setForeground(Color.red);

jldate.setBounds(220,20,100,25);

c.add(jldate);

Date d=new Date();

JTextField jtfdate = new JTextField();

DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);

jtfdate.setBounds(300,20,100,25);

jtfdate.setEditable(false);
String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfdate.setText(dt);

c.add(jtfdate);

mes = new JLabel("Wel-Come To Login Frame ");

mes.setBounds(70,60,300,30);

mes.setFont(new Font("Times New Roman",Font.BOLD,20));

mes.setForeground(Color.red);

c.add(mes);

l4=new JLabel("------------------------------------------------------------");

l4.setBounds(100,100,300,30);

l4.setFont(new Font("Times New Roman",Font.BOLD,15));

l4.setForeground(Color.white);

c.add(l4);

jlno = new JLabel("User Name : ");

jlno.setBounds(100,150,100,25);

jlno.setForeground(Color.red);

jlno.setFont(new Font("Times New Roman",Font.BOLD,15));

c.add(jlno);

jtfname = new JTextField(10);

jtfname.setBounds(200,150,100,25);
jtfname.setForeground(Color.red);

jtfname.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfname.requestFocus();

c.add(jtfname);

jlpass = new JLabel("Password : ");

jlpass.setBounds(100,200,100,25);

jlpass.setForeground(Color.red);

jlpass.setFont(new Font("Times New Roman",Font.BOLD,15));

c.add(jlpass);

jtfpass = new JPasswordField(25);

jtfpass.setForeground(Color.red);

jtfpass.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfpass.setBounds(200,200,100,25);

c.add(jtfpass);

ok = new JButton("! Ok !");

ok.setBorder(new LineBorder(Color.red));

ok.setToolTipText("Confirm password ");

ok.setMnemonic('o');

ok.setFont(new Font("Times New Roman",Font.BOLD,15));

ok.setBounds(100,300,100,25);

ok.setForeground(Color.black);

ok.addActionListener(this);
c.add(ok);

clear = new JButton("! Clear !");

clear.setBorder(new LineBorder(Color.red));

clear.setToolTipText("Clears the screen");

clear.setMnemonic('l');

clear.setFont(new Font("Times New Roman",Font.BOLD,15));

clear.setBounds(220,300,100,25);

clear.setForeground(Color.black);

clear.addActionListener(this);

c.add(clear);

cancel = new JButton("! Cancel !");

cancel.setBorder(new LineBorder(Color.red));

cancel.setToolTipText("Exit from password");

cancel.setMnemonic('c');

cancel.setFont(new Font("Times New Roman",Font.BOLD,15));

cancel.setBounds(340,300,100,25);

cancel.setForeground(Color.black);

cancel.addActionListener(this);

c.add(cancel);

c.setBackground(Color.black);

setBounds(130,130,500,400);

setVisible(true);
jtfname.requestFocus();

void set_connection()

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

c1 = DriverManager.getConnection("Jdbc:Odbc:database");

st1 = c1.createStatement();

rs1 = st1.executeQuery("Select * from book_pass");

catch(ClassNotFoundException c1)

System.out.println("\n Error : "+c1);

System.exit(0);

catch(SQLException s1)

System.out.println("\n Error : "+s1);

System.exit(0);

}
public void actionPerformed(ActionEvent a1)

String s = a1.getActionCommand();

if(s.equals("! Ok !"))

set_connection();

String li = jtfname.getText();

String ps = jtfpass.getText();

int flag=0;

try

while(rs1.next())

if( li.equals(rs1.getString(1)) && ps.equals(rs1.getString(2)) )

flag=1;

JOptionPane.showMessageDialog(this," Login
Successfull .......","Login",JOptionPane.INFORMATION_MESSAGE);

setVisible(false);

new booking1().setVisible(true);
}

catch(SQLException c1)

System.exit(0);

if(flag==0)

JOptionPane.showMessageDialog(this," Login
Failed ........","Login",JOptionPane.INFORMATION_MESSAGE);

jtfname.setText("");

jtfpass.setText("");

jtfname.requestFocus();

if(s.equals("! Clear !"))

jtfname.setText("");

jtfpass.setText("");

jtfname.requestFocus();

if(s.equals("! Cancel !"))

setVisible(false);

mainchoice m1 = new mainchoice();


}

/////////////////////////////////// FOR SETTINGS


PASSWORD ///////////////////////////////////////////////////////////

class pass2 extends JFrame implements ActionListener

JTextField jtfname;

JPasswordField jtfpass;

JLabel jlno,jlpass,jldate,mes,l4;

JButton ok,clear,cancel;

Container c;

Connection c1;

Statement st1;

ResultSet rs1 ;

pass2()

super(" Login Screen ");

c = getContentPane();

c.setLayout(null);
jldate = new JLabel("Date :");

jldate.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,15));

jldate.setForeground(Color.black);

jldate.setBounds(220,20,100,25);

c.add(jldate);

Date d=new Date();

JTextField jtfdate = new JTextField();

DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);

jtfdate.setBounds(300,20,100,25);

jtfdate.setEditable(false);

String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfdate.setText(dt);

c.add(jtfdate);

mes = new JLabel("Wel-Come To Login Frame ");

mes.setBounds(70,60,300,30);

mes.setFont(new Font("Times New Roman",Font.BOLD,20));

mes.setForeground(Color.black);

c.add(mes);

l4=new JLabel("------------------------------------------------------------");

l4.setBounds(100,100,300,30);

l4.setFont(new Font("Times New Roman",Font.BOLD,15));


l4.setForeground(Color.black);

c.add(l4);

jlno = new JLabel("User Name : ");

jlno.setBounds(100,150,100,25);

jlno.setFont(new Font("Times New Roman",Font.BOLD,15));

c.add(jlno);

jtfname = new JTextField(10);

jtfname.setBounds(200,150,100,25);

jtfname.setForeground(Color.red);

jtfname.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfname.requestFocus();

c.add(jtfname);

jlpass = new JLabel("Password : ");

jlpass.setBounds(100,200,100,25);

jlpass.setFont(new Font("Times New Roman",Font.BOLD,15));

c.add(jlpass);

jtfpass = new JPasswordField(25);

jtfpass.setForeground(Color.red);

jtfpass.setFont(new Font("Times New Roman",Font.BOLD,15));

jtfpass.setBounds(200,200,100,25);

c.add(jtfpass);
ok = new JButton("! Ok !");

ok.setBorder(new LineBorder(Color.red));

ok.setToolTipText("Confirm password ");

ok.setMnemonic('o');

ok.setFont(new Font("Times New Roman",Font.BOLD,15));

ok.setBounds(100,300,100,25);

ok.setForeground(Color.black);

ok.addActionListener(this);

c.add(ok);

clear = new JButton("! Clear !");

clear.setBorder(new LineBorder(Color.red));

clear.setToolTipText("Clears the screen");

clear.setMnemonic('l');

clear.setFont(new Font("Times New Roman",Font.BOLD,15));

clear.setBounds(220,300,100,25);

clear.setForeground(Color.black);

clear.addActionListener(this);

c.add(clear);

cancel = new JButton("! Cancel !");

cancel.setBorder(new LineBorder(Color.red));

cancel.setToolTipText("Exit from password");

cancel.setMnemonic('c');
cancel.setFont(new Font("Times New Roman",Font.BOLD,15));

cancel.setBounds(340,300,100,25);

cancel.setForeground(Color.black);

cancel.addActionListener(this);

c.add(cancel);

c.setBackground(new Color(193,193,0));

setBounds(130,130,500,400);

setVisible(true);

jtfname.requestFocus();

void set_connection()

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

c1 = DriverManager.getConnection("Jdbc:Odbc:database");

st1 = c1.createStatement();

rs1 = st1.executeQuery("Select * from set_pass");

catch(ClassNotFoundException c1)

{
System.exit(0);

catch(SQLException c1)

System.out.println("4 : "+c1);

System.exit(0);

public void actionPerformed(ActionEvent a1)

String s = a1.getActionCommand();

if(s.equals("! Ok !"))

set_connection();

String li = jtfname.getText();

String ps = jtfpass.getText();

int flag=0;

try

{
while(rs1.next())

if( li.equals(rs1.getString(1)) && ps.equals(rs1.getString(2)) )

flag=1;

JOptionPane.showMessageDialog(this,"Login
Successful .....","Login",JOptionPane.INFORMATION_MESSAGE);

setVisible(false);

new mainac().setVisible(true);

catch(SQLException c1)

System.exit(0);

if(flag==0)

JOptionPane.showMessageDialog(this,"Login
Failed.....","Login",JOptionPane.INFORMATION_MESSAGE);

jtfname.setText("");

jtfpass.setText("");
jtfname.requestFocus();

if(s.equals("! Clear !"))

jtfname.setText("");

jtfpass.setText("");

jtfname.requestFocus();

if(s.equals("! Cancel !"))

setVisible(false);

mainchoice m1 = new mainchoice();

//////////////////////////////////////// BOOKING 1 -
FRAME //////////////////////////////////////////////////////////

class booking1 extends JFrame implements ActionListener

{
JButton b,next,back;

JLabel l1,l2,ll1,ll2,ll3,ll4,ll5,jldate;

Container c;

int flag = 0;

booking1()

super(" Booking Details ");

c = getContentPane();

c.setLayout(null);

jldate = new JLabel("Date :");

jldate.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,30));

jldate.setForeground(Color.red);

jldate.setBounds(700,20,200,50);

c.add(jldate);

Date d=new Date();

JTextField jtfdate = new JTextField();

DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);

jtfdate.setBounds(800,30,200,35);

jtfdate.setEditable(false);
String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.BOLD,30));

jtfdate.setText(dt);

c.add(jtfdate);

ll5 = new JLabel("******************************************************************


");

ll5.setFont(new Font("Times New Roman", Font.BOLD, 30));

ll5.setForeground(Color.yellow);

ll5.setBounds(20,100,1200,100);

c.add(ll5);

l1 = new JLabel(" Please Set Movie Details ");

l1.setFont(new Font("Palatino Linotype", Font.BOLD+Font.ITALIC, 50));

l1.setForeground(Color.black);

l1.setBounds(200,150,1200,60);

c.add(l1);

ll3=new JLabel("& Show Details Using");

ll3.setFont(new Font("Palatino Linotype", Font.BOLD+Font.ITALIC, 50));

ll3.setForeground(Color.black);

ll3.setBounds(300,220,700,60);

c.add(ll3);

ll1 = new JLabel(" [Set Movie] ");

ll1.setFont(new Font("Times New Roman", Font.BOLD, 40));


ll1.setForeground(Color.black);

ll1.setBounds(450,300,700,60);

c.add(ll1);

ll4 = new
JLabel("***************************************************************** ");

ll4.setFont(new Font("Times New Roman", Font.BOLD, 30));

ll4.setForeground(Color.yellow);

ll4.setBounds(20,350,1200,100);

c.add(ll4);

b = new JButton("Set Movie");

b.setBorder(new LineBorder(Color.red));

b.setToolTipText(" Booking Details ");

b.setMnemonic('s');

b.setFont(new Font("Times New Roman",Font.BOLD,40));

b.setForeground(Color.black);

b.setBounds(450,450,200,70);

b.addActionListener(this);

c.add(b);

back = new JButton("Back");

back.setBorder(new LineBorder(Color.red));

back.setToolTipText("Go To Previous Page");

back.setMnemonic('b');

back.setBounds(450,600,200,70);
back.setForeground(Color.black);

back.setFont(new Font("Times New Roman",Font.BOLD,40));

back.addActionListener(this);

c.add(back);

c.setBackground(new Color(151,207,46));

setSize(Toolkit.getDefaultToolkit().getScreenSize());

show();

setVisible(true);

public void actionPerformed(ActionEvent a1)

String s1 = a1.getActionCommand();

if(s1.equals("Back"))

setVisible(false);

new mainchoice().setVisible(true);

if(s1.equals("Set Movie"))

setVisible(false);

new booking2().setVisible(true);
}

////////////////////////////////////////Show Report////////////////////////////////////

class sform extends JFrame implements ActionListener,FocusListener

String temp=jcmname.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(jcmname.getText());
}

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcmname.setText(null);

try

if(jcmname==f.getSource())

set_connection();

rs1=st1.executeQuery("select * from movie");

String value = (String) jcmname.getText();

int val = Integer.parseInt(value);


while(rs1.next())

if(rs1.getInt(1) == val)

jcmno.setText(""+rs1.getString(2));

catch(SQLException s1)

System.out.println("\n Error 7 : "+s1);

System.exit(0);

if(jcstbook==f.getSource())

int i = 0,f1=0;

String temp=jcstbook.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;
}

if(f1==0)

try

i = Integer.parseInt(jcstbook.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcstbook.setText(null);

if(jcendbook==f.getSource())

int i = 0,f1=0;

String temp=jcendbook.getText();
if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(jcendbook.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcendbook.setText(null);

}
if(t3==f.getSource())

int i = 0,f1=0;

String temp=t3.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(t3.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";


JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

t3.setText(null);

if(jcstbook1==f.getSource())

int i = 0,f1=0;

String temp=jcstbook1.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(jcstbook1.getText());

}
catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcstbook1.setText(null);

if(jcendbook1==f.getSource())

int i = 0,f1=0;

String temp=jcendbook1.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)
{

try

i = Integer.parseInt(jcendbook1.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcendbook1.setText(null);

if(t5==f.getSource())

int i = 0,f1=0;

String temp=t5.getText();

if(temp.equals(""))
{

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(t5.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

t5.setText(null);

if(jcst==f.getSource())

{
int i = 0,f1=0;

String temp=jcst.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(jcst.getText());

catch(Exception ne)

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);
jcst.setText(null);

if(jcbal==f.getSource())

int i = 0,f1=0;

String temp=jcbal.getText();

if(temp.equals(""))

System.out.println("HHH");

f1=1;

if(f1==0)

try

i = Integer.parseInt(jcbal.getText());

catch(Exception ne)
{

System.out.println("HBK");

String msg = "Invalid value";

JOptionPane.showMessageDialog(null,msg,"adm",JOptionPane.INFORMATION_MESSAGE);

jcbal.setText(null);

public void actionPerformed(ActionEvent a1)

String s1 = a1.getActionCommand();

if(s1.equals("Back"))

//setVisible(false);

dispose();

new mainac().setVisible(true);

}
if(s1.equals("Clear"))

trd.setText("");

jcmname.setText("");

jcstbook.setText("");

jcendbook.setText("");

t3.setText("");

jcstbook1.setText("");

jcendbook1.setText("");

t5.setText("");

jcst.setText("");

jcbal.setText("");

trd.requestFocus();

if(s1.equals("Save"))

set_connection();

try

pst1 = c1.prepareStatement("Insert into show


values(?,?,?,?,?,?,?,?,?,?,?)");
pst1.setString(1,trd.getText());

String d = (String) jctime.getSelectedItem();

pst1.setString(2,d);

d = (String)jcmname.getText();

pst1.setInt(3,Integer.parseInt(d));

d = (String)jcstbook.getText();

pst1.setInt(4,Integer.parseInt(d));

d = (String)jcendbook.getText();

pst1.setInt(5,Integer.parseInt(d));

d = (String)t3.getText();

pst1.setInt(6,Integer.parseInt(d));

d =(String)jcstbook1.getText();

pst1.setInt(7,Integer.parseInt(d));

d =(String)jcendbook1.getText();

pst1.setInt(8,Integer.parseInt(d));

d =(String)t5.getText();
pst1.setInt(9,Integer.parseInt(d));

d =(String)jcst.getText();

pst1.setInt(10,Integer.parseInt(d));

d =(String)jcbal.getText();

pst1.setInt(11,Integer.parseInt(d));

pst1.executeUpdate();

JOptionPane.showMessageDialog(this," Saved Successfully . . . . . .


","Save",JOptionPane.INFORMATION_MESSAGE);

catch(SQLException e1)

System.out.println("\n 3 : Error : "+e1);

}
///////////////////////////////////////// MOVIE
RECORDS //////////////////////////////////////////////////////////////////////////

class mform extends JFrame implements ActionListener,FocusListener

JLabel mno,mname,rd,ed,total,date,damp,damr,dno,damt,damtb;

JTextField tmno,tmname,trd,ted,ttotal,tdamp,tdamr,tdno,tdamt,dtotal,tdamtb;

JButton back,save,clear ;

Connection c1;

Statement st1;

PreparedStatement pst1,pst2;

ResultSet rs1;

mform()

super(" Movie Details ");

Container c = getContentPane();

c.setLayout(null);

Date d=new Date();


JTextField jtfdate = new JTextField();

DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT, Locale.UK);

jtfdate.setBounds(800,20,150,35);

jtfdate.setEditable(false);

String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.BOLD,30));

jtfdate.setText(dt);

c.add(jtfdate);

date = new JLabel("Date :-");

date.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC, 30));

date.setForeground(Color.red);

date.setBounds(700,20,100,35);

c.add(date);

mno = new JLabel("Movie No :-");

mno.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC, 25));

mno.setForeground(Color.red);

mno.setBounds(120,100,250,35);

c.add(mno);

tmno = new JTextField(5);

tmno.setBounds(450,100,250,35);

tmno.setForeground(Color.red);
tmno.setFont(new Font("Times New Roman",Font.BOLD,25));

tmno.addFocusListener(this);

c.add(tmno);

mname = new JLabel("Movie Name :- ");

mname.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC, 25));

mname.setForeground(Color.red);

mname.setBounds(120,150,250,35);

c.add(mname);

tmname = new JTextField(5);

tmname.setBounds(450,150,250,35);

tmname.setForeground(Color.red);

tmname.setFont(new Font("Times New Roman",Font.BOLD,25));

c.add(tmname);

rd = new JLabel("Release Date :- ");

rd.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,25));

rd.setForeground(Color.red);

rd.setBounds(120,200,250,35);

c.add(rd);

trd = new JTextField(5);

trd.setBounds(450,200,250,35);

trd.setForeground(Color.red);
trd.setFont(new Font("Times New Roman",Font.BOLD,25));

trd.addFocusListener(this);

c.add(trd);

dno = new JLabel("Distributer No :- ");

dno.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,25));

dno.setForeground(Color.red);

dno.setBounds(120,250,250,35);

c.add(dno);

tdno = new JTextField(5);

tdno.setBounds(450,250,250,35);

tdno.setForeground(Color.red);

tdno.setFont(new Font("Times New Roman",Font.BOLD,25));

tdno.addFocusListener(this);

c.add(tdno);

damt = new JLabel("Total Amount :- ");

damt.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,25));

damt.setForeground(Color.red);

damt.setBounds(120,300,250,35);

c.add(damt);
dtotal = new JTextField(5);

dtotal.setBounds(450,300,250,35);

dtotal.setForeground(Color.red);

dtotal.setFont(new Font("Times New Roman",Font.BOLD,25));

dtotal.addFocusListener(this);

c.add(dtotal);

damp = new JLabel("Amount paid :- ");

damp.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,25));

damp.setForeground(Color.red);

damp.setBounds(120,350,250,35);

c.add(damp);

tdamp = new JTextField(5);

tdamp.setBounds(450,350,250,35);

tdamp.setForeground(Color.red);

tdamp.setFont(new Font("Times New Roman",Font.BOLD,25));

tdamp.addFocusListener(this);

c.add(tdamp);

damtb = new JLabel("Amount Balanced :- ");

damtb.setFont(new Font("Times New Roman", Font.BOLD+Font.ITALIC,25));

damtb.setForeground(Color.red);

damtb.setBounds(120,400,250,35);
c.add(damtb);

tdamtb = new JTextField(5);

tdamtb.setBounds(450,400,250,35);

tdamtb.setForeground(Color.red);

tdamtb.setFont(new Font("Times New Roman",Font.BOLD,25));

tdamtb.addFocusListener(this);

tdamtb.setEditable(false);

c.add(tdamtb);

///////////////////////////////////// MOVIE REPORT////////////////////////////////

REPORT//////////////////////////////////////////////////

class dreport extends JFrame implements ActionListener

JButton back,print;

JTable jt;

JScrollPane jsp;

String s1[][];

int no;

JTextField jtfdate;

JLabel jldate,l1;
Connection c1;

PreparedStatement pst1;

Statement st1;

ResultSet rs1,rs2;

dreport()

super(" Movie Report ");

Container c = getContentPane();

c.setLayout(null);

//int i=0,j=0;

jldate = new JLabel("Date :- ");

jldate.setFont(new Font("Times New Roman",


Font.BOLD+Font.ITALIC,30));

jldate.setForeground(Color.red);

jldate.setBounds(750,20,200,50);

c.add(jldate);

Date d=new Date();

jtfdate = new JTextField();


DateFormat fmt = DateFormat.getDateInstance(DateFormat.SHORT,
Locale.UK);

jtfdate.setBounds(850,30,150,35);

jtfdate.setEditable(false);

String dt=fmt.format(d);

jtfdate.setFont(new Font("Times New Roman",Font.BOLD,30));

jtfdate.setText(dt);

c.add(jtfdate);

l1 = new JLabel("Movie's Report ");

l1.setFont(new Font("Times New Roman", Font.BOLD,50));

l1.setForeground(Color.red);

l1.setBounds(200,60,600,60);

c.add(l1);

// set_connection();

try

set_connection();

st1 =
c1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);

rs1 = st1.executeQuery("select * from Movie");


while(rs1.next())

no++;

catch(SQLException s1)

System.out.println("\n Error : "+s1);

catch(NullPointerException s1)

System.out.println("\n Error : "+s1);

catch(Exception e1)

System.out.println(""+e1);

int i=0,j=0;

s1=new String[no][7];

try

rs1.beforeFirst();
while(rs1.next())

s1[i][j++] = (String)rs1.getString(1);

s1[i][j++] = rs1.getString(2);

s1[i][j++] = (String)rs1.getString(3);

s1[i][j++] = (String)rs1.getString(4);

s1[i][j++] = (String)rs1.getString(5);

s1[i][j++] = (String)rs1.getString(6);

s1[i][j++] = (String)rs1.getString(7);

j=0;

i++;

catch(Exception e1)

System.out.println(" "+e1);

String s2[] = {"Movie no.","Movie Name","Release Date", "Distribitor No","Total


Amount","Amount Paid","Amount remaining"};

jt = new JTable(s1,s2);
jt.setRowHeight(25);

jt.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

jt.setColumnSelectionAllowed(true);

int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;

int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;

jt.setFont(new Font("comic sans ms", Font.BOLD,15));

jsp = new JScrollPane(jt,v,h);

jsp.setBounds(20,160,900,400);

jsp.setBorder(new BevelBorder(BevelBorder.LOWERED));

c.add(jsp);

print = new JButton("Print");

print.setBorder(new LineBorder(Color.red));

print.setToolTipText("Print records");

print.setMnemonic('p');

print.setBounds(350,600,150,50);

print.setForeground(Color.black);

print.setFont(new Font("Times New Roman",Font.BOLD,25));

print.addActionListener(this);

c.add(print);
back = new JButton("Back");

back.setBorder(new LineBorder(Color.red));

back.setToolTipText("Go To Previous Page");

back.setMnemonic('b');

back.setBounds(650,600,150,50);

back.setForeground(Color.black);

back.setFont(new Font("Times New Roman",Font.BOLD,25));

back.addActionListener(this);

c.add(back);

c.setBackground(new Color(184,203,126));

setSize(Toolkit.getDefaultToolkit().getScreenSize());

show();

setVisible(true);

void set_connection()

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

c1 = DriverManager.getConnection("Jdbc:Odbc:database");
st1 =
c1.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);

catch(ClassNotFoundException c1)

System.out.println("\n 2 : Error : "+c1);

catch(SQLException s1)

System.out.println("\n 3 : Error : "+s1);

public void actionPerformed(ActionEvent a1)

String s1 = a1.getActionCommand();

if(s1.equals("Back"))

setVisible(false);

new mainac().setVisible(true);
}

if(s1.equals("Print"))

try

jt.print();

catch(Exception e1)

System.out.println(""+e1);

}//dreport

///////////////////////////////////// MAIN CLASS - PROJECT //////////////////////////////////////

class movieproject

{
int ampaid=0,amtrem=0;

public static void main(String args[])

homepage h1 = new homepage();

You might also like