Online Ticket Booking System Programms
Online Ticket Booking System Programms
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class JavaApplication4 {
Connection conn=null;
public static Connection ConnecrDb(){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection conn
=DriverManager.getConnection("jdbc:mysql://localhost/java_dbmovies","root","");
return conn;
}
catch(Exception e)
{
System.out.println(e);
}
return null;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class CANCEL extends javax.swing.JFrame {
/**
* Creates new form CANCEL
*/
public CANCEL() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CANCEL.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CANCEL.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CANCEL.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CANCEL.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class cardselection extends javax.swing.JFrame {
/**
* Creates new form cardselection
*/
public cardselection() {
initComponents();
groupButton();
}
private void groupButton() {
}
String a;String b;String c;String e;String f;
int N1;
public cardselection(String p1,String p2,String p3,String p4,int p5,String p6){
initComponents();
this.a=p1;
this.b=p2;
this.c=p3;
this.e=p4;
this.N1=p5;
this.f=p6;
jLabel6.setText(p4);
jLabel7.setText(p2);
jLabel8.setText(p1);
jLabel9.setText(p6);
jLabel10.setText(String.valueOf(p5));
jLabel12.setText(p3);
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
}//GEN-LAST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton2ActionPerformed
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jRadioButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jRadioButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
import javax.swing.ButtonGroup;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class cardselection extends javax.swing.JFrame {
/**
* Creates new form cardselection
*/
public cardselection() {
initComponents();
groupButton();
}
private void groupButton() {
}
String a;String b;String c;String e;String f;
int N1;
public cardselection(String p1,String p2,String p3,String p4,int p5,String p6){
initComponents();
this.a=p1;
this.b=p2;
this.c=p3;
this.e=p4;
this.N1=p5;
this.f=p6;
jLabel6.setText(p4);
jLabel7.setText(p2);
jLabel8.setText(p1);
jLabel9.setText(p6);
jLabel10.setText(String.valueOf(p5));
jLabel12.setText(p3);
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
}//GEN-LAST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(cardselection.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
import java.sql.*;
import java.sql.DriverManager;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class movie extends javax.swing.JFrame {
/**
* Creates new form movie
*/
public movie() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
workWithDatabase();
}
public void workWithDatabase()
{
String a=(String) jComboBox1.getSelectedItem();
String b=(String) jComboBox2.getSelectedItem();
String e=(String) jComboBox3.getSelectedItem();
String f=(String) jComboBox4.getSelectedItem();
String d=jTextField1.getText();
Connection c=null;
Statement s=null;
ResultSet rs=null;
int flag=0;
//if(!a.equals(""))
String N=jTextField1.getText();
int N1=Integer.parseInt(N);
int N2=N1;
N1*=100;
//new recepit(a,b,e,d,N1,f).setVisible(true);
{
this.setVisible(false); new recepit(a,b,e,d,N1,f).setVisible(true);
try
{
Class.forName("com.mysql.jdbc.Driver");
c=DriverManager.getConnection("jdbc:mysql://localhost/java_dbmovies","root","");
s=c.createStatement();
b=(String) jComboBox2.getSelectedItem();
e=(String) jComboBox3.getSelectedItem();
String q1=b;
String q2=e;
rs=s.executeQuery("select tickets from table3 where theatre="+"'"+q1+"'"+" and
shows="+"'"+q2+"'");
String bid=jTextField1.getText();
int id=Integer.parseInt(bid);
rs=s.executeQuery("select tickets from table3 where theatre="+"'"+q1+"'"+" and
shows="+"'"+q2+"'");
while(rs.next())
{
String id1=rs.getString("tickets");
int id2=Integer.parseInt(id1);
id2=id2-N2;
//rs.close;
//s.close;
//c.close;
}
catch(SQLException | ClassNotFoundException e1)
{
System.out.println(e1);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(movie.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(movie.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(movie.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(movie.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class payment extends javax.swing.JFrame {
/**
* Creates new form payment
*/
public payment() {
initComponents();
}
String a;String b;String c;String e;String f;
int N1;
public payment(String p1,String p2,String p3,String p4,int p5,String p6){
initComponents();
this.a=p1;
this.b=p2;
this.c=p3;
this.e=p4;
this.N1=p5;
this.f=p6;
jLabel10.setText(p4);
jLabel14.setText(p2);
jLabel12.setText(p1);
jLabel15.setText(p6);
jLabel13.setText(String.valueOf(p5));
jLabel16.setText(p3);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(payment.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(payment.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(payment.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(payment.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
import java.sql.*;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class recepit extends javax.swing.JFrame {
/**
* Creates new form recepit
*/
public recepit() {
initComponents();
}
String a;String b;String c;String e;String f;
int N1;
public recepit(String p1,String p2,String p3,String p4,int p5,String p6){
initComponents();
this.a=p1;
this.b=p2;
this.c=p3;
this.e=p4;
this.N1=p5;
this.f=p6;
jLabel7.setText(p4);
jLabel8.setText(p2);
jLabel9.setText(p1);
jLabel10.setText(p3);
jLabel11.setText(String.valueOf(p5));
jLabel13.setText(p6);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(recepit.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(recepit.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(recepit.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(recepit.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class recepit1 extends javax.swing.JFrame {
/**
* Creates new form recepit1
*/
public recepit1() {
initComponents();
}
String a;String b;String c;String e;String f;
int N1;
public recepit1(String p1,String p2,String p3,String p4,int p5,String p6){
initComponents();
this.a=p1;
this.b=p2;
this.c=p3;
this.e=p4;
this.N1=p5;
this.f=p6;
jLabel7.setText(p4);
jLabel8.setText(p2);
jLabel9.setText(p1);
jLabel10.setText(p3);
jLabel11.setText(String.valueOf(p5));
jLabel13.setText(p6);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "RECEPIT",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Algerian", 1, 36), new
java.awt.Color(51, 0, 204))); // NOI18N
jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
jLabel4.setText("THEATRE:");
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(recepit1.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(recepit1.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(recepit1.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(recepit1.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
recepit1 getVisible(boolean b) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of
generated methods, choose Tools | Templates.
}
}
import java.sql.*;
import java.sql.DriverManager;
import java.util.logging.Level;
import java.util.logging.Logger;
import javaapplication4.JavaApplication4;
import java.sql.SQLException;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PRATAP KUMAR
*/
public class register extends javax.swing.JFrame {
Connection conn=null;
/**
* Creates new form register
*/
public register() {
initComponents();
conn=JavaApplication4.ConnecrDb();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(1080, 754));
getContentPane().setLayout(null);
pack();
}// </editor-fold>//GEN-END:initComponents
/**Statement s;
ResultSet rs;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn =DriverManager.getConnection("jdbc:mysql://localhost/db","root","");
s=conn.createStatement();
//int i=0,y=0,e=0;
//
s=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
//rs=executeQuery("select * from register");
//a=jTextField1.getText();
/**While (rs.next() && y==0)
;{
String p=rs.getString("name");
a=jTextField1.getText();
System.out.println(p+""+a);
}
System.out.println(e);
s.executeUpdate("insert into register values('"+a+"','"+b+"','"+c+"');");
}
catch(Exception e)
{
System.out.println(e);
}**/
if("".equals(a) && "".equals(b) && "".equals(c))
{
JOptionPane.showMessageDialog(this,"please enter valid details");
}
else {
try{
Statement s =conn.createStatement();
String s1=("insert into register values('"+a+"','"+b+"','"+c+"');");
System.out.println("success");
s.executeUpdate(s1);
}
catch(SQLException e)
{
Logger.getLogger(register.class.getName()).log(Level.SEVERE,null,e);
}