77
CINEITSX MANUAL TÉCNICO

Manual técnico CINEITSX

Embed Size (px)

DESCRIPTION

Instituto Tecnológico Superior de Xalapa Taller de Base de Datos

Citation preview

Page 1: Manual técnico CINEITSX

CINEITSX

MANUAL TÉCNICO

Page 2: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

Page 3: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

CINEITSX

ELE-MENTOS

LIZBETH ANDREA CORRALES PROTT

ELIZABETH HERNANDEZ TEPETLAN

EDER ANTUAN VELAZQUEZ VALENCIA

Page 4: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

Clase: Login.java

import java.awt.Desktop; import java.awt.event.KeyEvent; import java.net.*; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; 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 Lizbeth */ public class Login extends javax.swing.JFrame { /** * Creates new form Login */ public Login() { initComponents(); } void acceder(String usuario, String pass){ String cap=""; conectar cc = new conectar(); Connection cn = cc.conexion(); String sql="SELECT * FROM usuario WHERE usuario='"+usuario+"' AND contrasena='"+pass+"'"; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ cap=rs.getString("tipousuario"); }

CODIGO

Page 5: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

if(cap.equals("administrador")){ Ciudad obj= new Ciudad(); obj.setVisible(true); dispose(); } if(cap.equals("empleado")){ EmpleadoVentaBoletos obj= new EmpleadoVentaBoletos(); obj.setVisible(true); dispose(); } if((!cap.equals("administrador")) && (!cap.equals("empleado"))){ JOptionPane.showMessageDialog(this, "Usuario o Contraseña Invalidos"); } } catch (SQLException ex) { Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex); } } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); t_user = new javax.swing.JTextField(); t_password = new javax.swing.JPasswordField(); jButton1 = new javax.swing.JButton(); b_login = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(255, 0, 51)); jTextField1.setEditable(false); jTextField1.setBackground(new java.awt.Color(255, 0, 51)); jTextField1.setFont(new java.awt.Font("Calibri", 1, 60)); // NOI18N jTextField1.setForeground(new java.awt.Color(255, 255, 255)); jTextField1.setText("CINEITSX"); jTextField1.setBorder(null); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jLabel1.setBackground(new java.awt.Color(255, 0, 51)); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N

Page 6: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("USUARIO:"); jLabel2.setBackground(new java.awt.Color(255, 0, 51)); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("CONTRASEÑA:"); t_user.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_userActionPerformed(evt); } }); t_user.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_userKeyTyped(evt); } }); t_password.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_passwordKeyTyped(evt); } }); jButton1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\ICON_AYUDA.png")); // NOI18N jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); b_login.setBackground(new java.awt.Color(64, 240, 144)); b_login.setFont(new java.awt.Font("Tahoma", 0, 20)); // NOI18N b_login.setText("ENTRAR"); b_login.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_loginActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup()

Page 7: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(171, 171, 171) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(78, 78, 78) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(b_login) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2) .addComponent(jLabel1)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(t_user) .addComponent(t_password, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addGap(0, 121, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(51, 51, 51) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(t_user) .addComponent(jLabel1)) .addGap(18, 18, 18)

Page 8: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(t_password, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(b_login) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE) .addComponent(jButton1) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold> private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void b_loginActionPerformed(java.awt.event.ActionEvent evt) { String user=t_user.getText(); String password=new String(t_password.getPassword()); acceder(user,password); }

Page 9: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

private void t_userKeyTyped(java.awt.event.KeyEvent evt) { if(t_user.getText().length()>45){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isDefined(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } private void t_passwordKeyTyped(java.awt.event.KeyEvent evt) { if(t_password.getPassword().length >20){ evt.setKeyChar('\0'); } } private void t_userActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { Desktop.getDesktop().browse(new URL("http://localhost/Cine/").toURI()); } catch (Exception e) {} } /** * @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;

Page 10: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Login().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton b_login; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField1; private javax.swing.JPasswordField t_password; private javax.swing.JTextField t_user; // End of variables declaration }

Clase: Agregar.java

import java.awt.event.KeyEvent; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*;

Page 11: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

/* * 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 Lizbeth */ public class Agregarpax extends javax.swing.JFrame { /** * Creates new form Ciudad */ public Agregarpax() { initComponents(); setLocationRelativeTo(null); setResizable(false); setTitle("Agregar Pelicula Plaza Americas Xalapa"); cargar(); limpiar(); bloquear(); } void cargarTipo(){ c_idtipo.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String tipo = (String)c_tip.getSelectedItem(); String sql="SELECT idtipo FROM tipo WHERE tipo='"+ tipo+"'" ; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_idtipo.addItem(rs.getString("idtipo")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } }

Page 12: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

void cargarSala(){ c_ids.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String nsal = (String)c_sal.getSelectedItem(); String sql="SELECT idsala FROM sala WHERE numsala='"+ nsal+"' AND complejo_idcomplejo=1" ; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_ids.addItem(rs.getString("idsala")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void cargarPelicula(){ c_idp.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String tit = t_tit.getText(); String idd = (String)c_idd.getSelectedItem(); String sql="SELECT idpelicula FROM pelicula WHERE titulo='"+ tit +"' AND director_iddirector ='"+ idd +"'" ; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_idp.addItem(rs.getString("idpelicula")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } }

Page 13: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

void cargarActor(){ c_ida1.removeAllItems(); c_ida2.removeAllItems(); c_ida3.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String act1 = (String)c_act1.getSelectedItem(); String act2 = (String)c_act2.getSelectedItem(); String act3 = (String)c_act3.getSelectedItem(); String sql1="SELECT idactor FROM actor WHERE nombre='"+ act1+"'" ; String sql2="SELECT idactor FROM actor WHERE nombre='"+ act2+"'" ; String sql3="SELECT idactor FROM actor WHERE nombre='"+ act3+"'" ; try { Statement st1 = cn.createStatement(); Statement st2 = cn.createStatement(); Statement st3 = cn.createStatement(); ResultSet rs1 = st1.executeQuery(sql1); ResultSet rs2 = st2.executeQuery(sql2); ResultSet rs3 = st3.executeQuery(sql3); while(rs1.next()){ this.c_ida1.addItem(rs1.getString("idactor")); } while(rs2.next()){ this.c_ida2.addItem(rs2.getString("idactor")); } while(rs3.next()){ this.c_ida3.addItem(rs3.getString("idactor")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void cargarDirector(){ c_idd.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String dir = (String)c_dir.getSelectedItem(); String sql="SELECT iddirector FROM director WHERE nombre='"+ dir+"'" ; try {

Page 14: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_idd.addItem(rs.getString("iddirector")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void cargar(){ this.c_tip.removeAllItems(); this.c_dir.removeAllItems(); this.c_act1.removeAllItems(); this.c_act2.removeAllItems(); this.c_act3.removeAllItems(); this.c_sal.removeAllItems(); String sql1 = "SELECT * FROM tipo"; String sql2 = "SELECT * FROM director"; String sql3 = "SELECT * FROM actor"; String sql4 = "SELECT * FROM sala WHERE complejo_idcomplejo=1"; conectar cc=new conectar(); Connection cn = cc.conexion(); Statement st1; Statement st2; Statement st3; Statement st4; try { st1 = cn.createStatement(); st2 = cn.createStatement(); st3 = cn.createStatement(); st4 = cn.createStatement(); ResultSet rs1 = st1.executeQuery(sql1); ResultSet rs2 = st2.executeQuery(sql2); ResultSet rs3 = st3.executeQuery(sql3); ResultSet rs4 = st4.executeQuery(sql4); while(rs1.next()){ this.c_tip.addItem(rs1.getString("tipo")); } while(rs2.next()){ this.c_dir.addItem(rs2.getString("nombre")); } while(rs3.next()){

Page 15: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

this.c_act1.addItem(rs3.getString("nombre")); this.c_act2.addItem(rs3.getString("nombre")); this.c_act3.addItem(rs3.getString("nombre")); } while(rs4.next()){ this.c_sal.addItem(rs4.getString("numsala")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void limpiar(){ t_tit.setText(""); t_dur.setText(""); t_sin.setText(""); t_fec.setText(""); t_hor.setText(""); } void bloquear(){ t_tit.setEnabled(false); c_gen.setEnabled(false); c_tip.setEnabled(false); c_cla.setEnabled(false); t_dur.setEnabled(false); c_dir.setEnabled(false); c_act1.setEnabled(false); c_act2.setEnabled(false); c_act3.setEnabled(false); t_sin.setEnabled(false); t_fec.setEnabled(false); t_hor.setEnabled(false); c_sal.setEnabled(false); b_nuevo.setEnabled(true); b_agregar.setEnabled(false); b_cancelar.setEnabled(false); b_agregarpelicula.setEnabled(false); b_agregaractores.setEnabled(false); } void desbloquear(){ t_tit.setEnabled(true); c_gen.setEnabled(true); c_tip.setEnabled(true); c_cla.setEnabled(true); t_dur.setEnabled(true);

Page 16: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

c_dir.setEnabled(true); t_sin.setEnabled(true); b_agregarpelicula.setEnabled(true); b_cancelar.setEnabled(true); b_nuevo.setEnabled(false); } void agregarPelicula(){ conectar cc = new conectar(); Connection cn = cc.conexion(); String tit,gen,cla,dur,sin,idd; tit = t_tit.getText(); gen = (String)c_gen.getSelectedItem(); cla = (String)c_cla.getSelectedItem(); dur = t_dur.getText(); sin = t_sin.getText(); idd = (String)c_idd.getSelectedItem(); String sql1="INSERT INTO pelicula (titulo, genero, clasificacion, duracion, sinopsis, director_iddirector) VALUES (?,?,?,?,?,?)"; try { PreparedStatement pst1 = cn.prepareStatement(sql1); pst1.setString(1, tit); pst1.setString(2, gen); pst1.setString(3, cla); pst1.setString(4, dur); pst1.setString(5, sin); pst1.setString(6, idd); int n=pst1.executeUpdate(); if(n>0){ } } catch (SQLException ex) { Logger.getLogger(Agregarpax.class.getName()).log(Level.SEVERE, null, ex); } } void agregarTipo(){ conectar cc = new conectar(); Connection cn = cc.conexion(); String idt, idp; idt = (String)c_idtipo.getSelectedItem(); idp = (String)c_idp.getSelectedItem(); String sql1="INSERT INTO traduccion (tipo_idtipo, pelicula_idpelicula) VALUES (?,?)";

Page 17: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

try { PreparedStatement pst1 = cn.prepareStatement(sql1); pst1.setString(1, idt); pst1.setString(2, idp); pst1.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(Agregarpax.class.getName()).log(Level.SEVERE, null, ex); } } void agregarActor(){ conectar cc = new conectar(); Connection cn = cc.conexion(); String act1, act2, act3, idp; act1 = (String)c_ida1.getSelectedItem(); act2 = (String)c_ida2.getSelectedItem(); act3 = (String)c_ida3.getSelectedItem(); idp = (String)c_idp.getSelectedItem(); String sql1="INSERT INTO actua (pelicula_idpelicula, actor_idactor) VALUES (?,?)"; try { PreparedStatement pst1 = cn.prepareStatement(sql1); PreparedStatement pst2 = cn.prepareStatement(sql1); PreparedStatement pst3 = cn.prepareStatement(sql1); pst1.setString(1, idp); pst1.setString(2, act1); pst1.executeUpdate(); pst2.setString(1, idp); pst2.setString(2, act2); pst2.executeUpdate(); pst3.setString(1, idp); pst3.setString(2, act3); pst3.executeUpdate(); } catch (SQLException ex) { Logger.getLogger(Agregarpax.class.getName()).log(Level.SEVERE, null, ex); } }

Page 18: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

void agregarFuncion(){ conectar cc = new conectar(); Connection cn = cc.conexion(); String fec, hor, lugv, lugr, idp, ids; fec = t_fec.getText(); hor = t_hor.getText(); lugv = "0"; lugr = "0"; idp = (String)c_idp.getSelectedItem(); ids = (String)c_ids.getSelectedItem(); String sql1="INSERT INTO funcion (fecha, hora, lugvendidos, lugreservados, pelicula_idpelicula, sala_idsala) VALUES (?,?,?,?,?,?)"; try { PreparedStatement pst1 = cn.prepareStatement(sql1); pst1.setString(1, fec); pst1.setString(2, hor); pst1.setString(3, lugv); pst1.setString(4, lugr); pst1.setString(5, idp); pst1.setString(6, ids); int n=pst1.executeUpdate(); if(n>0){ JOptionPane.showMessageDialog(null, "Registro Agregado con Exito"); } } catch (SQLException ex) { Logger.getLogger(Agregarpax.class.getName()).log(Level.SEVERE, null, ex); } } /** * 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"> private void initComponents() { c_idtipo = new javax.swing.JComboBox(); c_ids = new javax.swing.JComboBox(); c_idp = new javax.swing.JComboBox(); c_idd = new javax.swing.JComboBox(); c_ida1 = new javax.swing.JComboBox(); c_ida2 = new javax.swing.JComboBox(); c_ida3 = new javax.swing.JComboBox();

Page 19: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); b_agregar = new javax.swing.JButton(); b_cancelar = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); t_tit = new javax.swing.JTextField(); c_gen = new javax.swing.JComboBox(); jLabel11 = new javax.swing.JLabel(); c_tip = new javax.swing.JComboBox(); c_cla = new javax.swing.JComboBox(); t_dur = new javax.swing.JTextField(); c_dir = new javax.swing.JComboBox(); c_act1 = new javax.swing.JComboBox(); c_act2 = new javax.swing.JComboBox(); c_act3 = new javax.swing.JComboBox(); jScrollPane1 = new javax.swing.JScrollPane(); t_sin = new javax.swing.JTextArea(); b_agregarpelicula = new javax.swing.JButton(); b_agregaractores = new javax.swing.JButton(); b_nuevo = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); t_fec = new javax.swing.JTextField(); t_hor = new javax.swing.JTextField(); c_sal = new javax.swing.JComboBox(); c_idtipo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(0, 0, 153)); setPreferredSize(new java.awt.Dimension(640, 620)); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\LOGO.png")); // NOI18N jLabel2.setFont(new java.awt.Font("Calibri", 1, 48)); // NOI18N

Page 20: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jLabel2.setText("CINEITSX"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("AGREGAR"); b_agregar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N b_agregar.setText("AGREGAR"); b_agregar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_agregarActionPerformed(evt); } }); b_cancelar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N b_cancelar.setText("CANCELAR"); b_cancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_cancelarActionPerformed(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Pelicula")); jLabel4.setText("Titulo:"); jLabel5.setText("Genero:"); jLabel6.setText("Clasificación:"); jLabel7.setText("Duración:"); jLabel8.setText("Sinopsis:"); jLabel9.setText("Director:"); jLabel10.setText("Actores:"); t_tit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_titActionPerformed(evt); } }); t_tit.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_titKeyTyped(evt); } });

Page 21: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

c_gen.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ACCIÓN Y AVENTURA", "DRAMA", "TERROR", "COMEDIA", "SUSPENSO" })); jLabel11.setText("Tipo:"); c_tip.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); c_cla.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "A", "AA", "B", "B15", "C" })); t_dur.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_durKeyTyped(evt); } }); c_dir.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); c_act1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); c_act2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); c_act3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); t_sin.setColumns(20); t_sin.setRows(5); t_sin.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_sinKeyTyped(evt); } }); jScrollPane1.setViewportView(t_sin); b_agregarpelicula.setText("+"); b_agregarpelicula.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_agregarpeliculaActionPerformed(evt); } }); b_agregaractores.setText("+"); b_agregaractores.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_agregaractoresActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

Page 22: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel11)) .addGap(42, 42, 42) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(c_tip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_dur)) .addComponent(t_tit, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel7) .addGap(173, 173, 173) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(20, 20, 20) .addComponent(jLabel9)) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(23, 23, 23) .addComponent(jLabel5))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(c_gen, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(c_cla, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

Page 23: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(c_dir, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(89, 89, 89)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(jLabel10)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(9, 9, 9) .addComponent(c_act1, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(63, 63, 63) .addComponent(c_act2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(63, 63, 63) .addComponent(c_act3, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 369, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(b_agregarpelicula, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(b_agregaractores, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(25, 25, 25)))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(t_tit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(c_gen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

Page 24: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) .addComponent(c_tip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6) .addComponent(c_cla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(t_dur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel9) .addComponent(c_dir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(b_agregarpelicula)) .addGap(8, 8, 8) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10) .addComponent(c_act1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(c_act2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(c_act3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b_agregaractores)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); b_nuevo.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N b_nuevo.setText("NUEVO"); b_nuevo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_nuevoActionPerformed(evt); } });

Page 25: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Función")); jLabel12.setText("Fecha:"); jLabel13.setText("Hora:"); jLabel14.setText("Sala:"); t_fec.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_fecActionPerformed(evt); } }); t_fec.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_fecKeyTyped(evt); } }); t_hor.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_horKeyTyped(evt); } }); c_sal.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel12) .addGap(18, 18, 18) .addComponent(t_fec, javax.swing.GroupLayout.DEFAULT_SIZE, 167, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jLabel13) .addGap(18, 18, 18) .addComponent(t_hor, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(28, 28, 28) .addComponent(jLabel14) .addGap(18, 18, 18) .addComponent(c_sal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(57, 57, 57))

Page 26: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(jLabel13) .addComponent(jLabel14) .addComponent(t_fec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_hor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(c_sal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(13, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(b_nuevo) .addGap(132, 132, 132) .addComponent(b_agregar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(b_cancelar)) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(189, 189, 189) .addComponent(jLabel1) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

Page 27: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(jLabel2) .addComponent(jLabel3)))) .addGap(0, 53, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(59, 59, 59))) .addGap(18, 18, 18) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 114, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(b_nuevo) .addComponent(b_agregar) .addComponent(b_cancelar)) .addContainerGap()) ); pack(); }// </editor-fold> private void b_agregarActionPerformed(java.awt.event.ActionEvent evt) { if(t_fec.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Fecha", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_hor.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Hora", "Error", JOptionPane.ERROR_MESSAGE);

Page 28: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} else{ cargarSala(); agregarFuncion(); cargarTipo(); agregarTipo(); bloquear(); Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } } } private void b_nuevoActionPerformed(java.awt.event.ActionEvent evt) { desbloquear(); } private void t_titActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void b_cancelarActionPerformed(java.awt.event.ActionEvent evt) { Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } private void b_agregarpeliculaActionPerformed(java.awt.event.ActionEvent evt) { if(t_tit.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa el Titulo", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_dur.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Duracion", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_sin.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Sinopsis", "Error", JOptionPane.ERROR_MESSAGE); } else{ cargarDirector(); agregarPelicula(); cargarPelicula();

Page 29: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

b_agregarpelicula.setEnabled(false); c_act1.setEnabled(true); c_act2.setEnabled(true); c_act3.setEnabled(true); b_agregaractores.setEnabled(true); } } } } private void b_agregaractoresActionPerformed(java.awt.event.ActionEvent evt) { cargarActor(); agregarActor(); t_fec.setEnabled(true); t_hor.setEnabled(true); c_sal.setEnabled(true); b_agregar.setEnabled(true); b_agregaractores.setEnabled(false); } private void t_titKeyTyped(java.awt.event.KeyEvent evt) { if(t_tit.getText().length()>99){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } private void t_durKeyTyped(java.awt.event.KeyEvent evt) { if(t_dur.getText().length()>5){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetterOrDigit(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); } } private void t_sinKeyTyped(java.awt.event.KeyEvent evt) {

Page 30: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

if(t_sin.getText().length()>149){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); } } private void t_fecKeyTyped(java.awt.event.KeyEvent evt) { if(t_fec.getText().length()>9){ evt.setKeyChar('\0'); } } private void t_horKeyTyped(java.awt.event.KeyEvent evt) { if(t_hor.getText().length()>7){ evt.setKeyChar('\0'); } } private void t_fecActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } /** * @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) {

Page 31: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Ciudad().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton b_agregar; private javax.swing.JButton b_agregaractores; private javax.swing.JButton b_agregarpelicula; private javax.swing.JButton b_cancelar; private javax.swing.JButton b_nuevo; private javax.swing.JComboBox c_act1; private javax.swing.JComboBox c_act2; private javax.swing.JComboBox c_act3; private javax.swing.JComboBox c_cla; private javax.swing.JComboBox c_dir; private javax.swing.JComboBox c_gen; private javax.swing.JComboBox c_ida1; private javax.swing.JComboBox c_ida2; private javax.swing.JComboBox c_ida3; private javax.swing.JComboBox c_idd; private javax.swing.JComboBox c_idp; private javax.swing.JComboBox c_ids; private javax.swing.JComboBox c_idtipo; private javax.swing.JComboBox c_sal; private javax.swing.JComboBox c_tip; private javax.swing.JLabel jLabel1;

Page 32: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField t_dur; private javax.swing.JTextField t_fec; private javax.swing.JTextField t_hor; private javax.swing.JTextArea t_sin; private javax.swing.JTextField t_tit; // End of variables declaration }

Clase: Consultar.java

import java.awt.event.KeyEvent; import java.sql.*; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class Consultarpax extends javax.swing.JFrame { DefaultTableModel model; public Consultarpax() { initComponents(); setLocationRelativeTo(null); setResizable(false); setTitle("Consultar Pelicula Plaza Americas Xalapa"); cargar(""); } void cargar(String valor){ String [] titulos={"Codigo","Titulo","Genero","Clasificación","Duración","Sinopsis"}; String [] registros = new String[6]; String sql = "SELECT * FROM pelicula WHERE titulo LIKE '%"+valor+"%'";

Page 33: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

model = new DefaultTableModel(null,titulos); conectar cc=new conectar(); Connection cn = cc.conexion(); Statement st; try { st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ registros[0]=rs.getString("idpelicula"); registros[1]=rs.getString("titulo"); registros[2]=rs.getString("genero"); registros[3]=rs.getString("clasificacion"); registros[4]=rs.getString("duracion"); registros[5]=rs.getString("sinopsis"); model.addRow(registros); } t_datos.setModel(model); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } /** * 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"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); aux = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); t_datos = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(0, 0, 153));

Page 34: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

setPreferredSize(new java.awt.Dimension(640, 620)); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\LOGO.png")); // NOI18N jLabel2.setFont(new java.awt.Font("Calibri", 1, 48)); // NOI18N jLabel2.setText("CINEITSX"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("CONSULTAR"); jButton6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton6.setText("REGRESAR"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jLabel4.setText("Buscar:"); aux.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { auxKeyReleased(evt); } public void keyTyped(java.awt.event.KeyEvent evt) { auxKeyTyped(evt); } }); t_datos.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {} }, new String [] { } )); jScrollPane1.setViewportView(t_datos); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

Page 35: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(45, 45, 45) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(jButton6)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(164, 164, 164) .addComponent(jLabel1) .addGap(10, 10, 10) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(260, 260, 260) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(aux, javax.swing.GroupLayout.PREFERRED_SIZE, 469, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 56, Short.MAX_VALUE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addComponent(jLabel3) .addGap(13, 13, 13) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4)

Page 36: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(aux, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6) .addContainerGap()) ); pack(); }// </editor-fold> private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } private void auxKeyReleased(java.awt.event.KeyEvent evt) { cargar(aux.getText()); } private void auxKeyTyped(java.awt.event.KeyEvent evt) { if(aux.getText().length()>99){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } /** * @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 */

Page 37: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

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(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Ciudad().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField aux; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable t_datos; // End of variables declaration }

Page 38: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

Clase: Modificar.java

import java.awt.event.KeyEvent; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; /* * 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 Lizbeth */ public class Modificarpax extends javax.swing.JFrame { DefaultTableModel model; /** * Creates new form Ciudad */ public Modificarpax() { initComponents(); setLocationRelativeTo(null); setResizable(false); setTitle("Modificar Pelicula Plaza Americas Xalapa"); cargar(); bloquear(); } void bloquear(){ t_tit.setEnabled(false); t_gen.setEnabled(false); t_cla.setEnabled(false); t_dur.setEnabled(false); t_sin.setEnabled(false); b_modificar.setEnabled(false); } void desbloquear(){ t_tit.setEnabled(true); t_gen.setEnabled(true); t_cla.setEnabled(true);

Page 39: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

t_dur.setEnabled(true); t_sin.setEnabled(true); b_modificar.setEnabled(true); } void cargar(){ String [] titulos={"Codigo","Titulo","Genero","Clasificación","Duración","Sinopsis"}; String [] registros = new String[6]; String sql = "SELECT * FROM pelicula"; model = new DefaultTableModel(null,titulos); conectar cc=new conectar(); Connection cn = cc.conexion(); try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ registros[0]=rs.getString("idpelicula"); registros[1]=rs.getString("titulo"); registros[2]=rs.getString("genero"); registros[3]=rs.getString("clasificacion"); registros[4]=rs.getString("duracion"); registros[5]=rs.getString("sinopsis"); model.addRow(registros); } t_datos.setModel(model); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } /** * 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"> private void initComponents() { jPopupMenu1 = new javax.swing.JPopupMenu();

Page 40: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jMenuItem1 = new javax.swing.JMenuItem(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); t_datos = new javax.swing.JTable(); b_modificar = new javax.swing.JButton(); t_tit = new javax.swing.JTextField(); t_gen = new javax.swing.JTextField(); t_cla = new javax.swing.JTextField(); t_dur = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); t_sin = new javax.swing.JTextArea(); t_idp = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jMenuItem1.setText("modificar"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jPopupMenu1.add(jMenuItem1); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(0, 0, 153)); setPreferredSize(new java.awt.Dimension(640, 620)); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\LOGO.png")); // NOI18N jLabel2.setFont(new java.awt.Font("Calibri", 1, 48)); // NOI18N jLabel2.setText("CINEITSX"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("MODIFICAR"); jButton6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton6.setText("REGRESAR"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {

Page 41: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jButton6ActionPerformed(evt); } }); jLabel4.setText("Titulo:"); jLabel5.setText("Genero:"); jLabel6.setText("Clasificación:"); jLabel7.setText("Duración:"); jLabel8.setText("Sinopsis:"); t_datos.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {} }, new String [] { } )); t_datos.setComponentPopupMenu(jPopupMenu1); jScrollPane1.setViewportView(t_datos); b_modificar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N b_modificar.setText("MODIFICAR"); b_modificar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { b_modificarActionPerformed(evt); } }); t_tit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { t_titActionPerformed(evt); } }); t_tit.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_titKeyTyped(evt); } }); t_gen.addKeyListener(new java.awt.event.KeyAdapter() {

Page 42: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

public void keyTyped(java.awt.event.KeyEvent evt) { t_genKeyTyped(evt); } }); t_cla.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_claKeyTyped(evt); } }); t_dur.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_durKeyTyped(evt); } }); t_sin.setColumns(20); t_sin.setRows(5); t_sin.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_sinKeyTyped(evt); } }); jScrollPane2.setViewportView(t_sin); t_idp.setText("-"); jLabel9.setText("Codigo:"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(164, 164, 164) .addComponent(jLabel1) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

Page 43: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(jLabel3) .addComponent(jLabel2))) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(321, 321, 321) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel5) .addComponent(jLabel7))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel9)) .addGap(45, 45, 45) .addComponent(t_idp, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(t_gen, javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE) .addComponent(t_dur))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jLabel8)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(t_cla, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(t_tit, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(293, 293, 293))))) .addGap(0, 0, Short.MAX_VALUE))

Page 44: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addComponent(b_modificar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6))))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jLabel3) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_idp) .addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(t_tit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(t_gen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(t_cla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7) .addComponent(t_dur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel8)

Page 45: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(26, 26, 26) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6) .addComponent(b_modificar)) .addContainerGap(74, Short.MAX_VALUE)) ); pack(); }// </editor-fold> private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { desbloquear(); int fila = t_datos.getSelectedRow(); if(fila >= 0){ t_idp.setText(t_datos.getValueAt(fila, 0).toString()); t_tit.setText(t_datos.getValueAt(fila, 1).toString()); t_gen.setText(t_datos.getValueAt(fila, 2).toString()); t_cla.setText(t_datos.getValueAt(fila, 3).toString()); t_dur.setText(t_datos.getValueAt(fila, 4).toString()); t_sin.setText(t_datos.getValueAt(fila, 5).toString()); } else{ JOptionPane.showMessageDialog(null, "No selecciono fila"); } } private void t_titActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void b_modificarActionPerformed(java.awt.event.ActionEvent evt) { if(t_tit.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa el Titulo", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_gen.getText().isEmpty()){

Page 46: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

JOptionPane.showMessageDialog(null, "Ingresa el Genero", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_cla.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Clasificacion", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_dur.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Duracion", "Error", JOptionPane.ERROR_MESSAGE); } else{ if(t_sin.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa la Sinopsis", "Error", JOptionPane.ERROR_MESSAGE); } else{ conectar cc=new conectar(); Connection cn = cc.conexion(); String idp, tit, gen, cla, dur, sin; idp = t_idp.getText(); tit = t_tit.getText(); gen = t_gen.getText(); cla = t_cla.getText(); dur = t_dur.getText(); sin = t_sin.getText(); String sql = "UPDATE pelicula SET titulo='" + tit + "', genero='" + gen + "', clasificacion='" + cla + "', duracion='" + dur + "', sinopsis='" + sin +"' WHERE idpelicula='" + idp +"'"; try { PreparedStatement pst =cn.prepareStatement(sql); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Regristro Modificado con exito"); cargar(); bloquear(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e); } } } } } }

Page 47: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} private void t_titKeyTyped(java.awt.event.KeyEvent evt) { if(t_tit.getText().length()>99){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } private void t_genKeyTyped(java.awt.event.KeyEvent evt) { if(t_gen.getText().length()>29){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } private void t_claKeyTyped(java.awt.event.KeyEvent evt) { if(t_cla.getText().length()>2){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetterOrDigit(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } private void t_durKeyTyped(java.awt.event.KeyEvent evt) { if(t_dur.getText().length()>5){ evt.setKeyChar('\0'); } char tecla;

Page 48: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

tecla=evt.getKeyChar(); if(!Character.isLetterOrDigit(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); } } private void t_sinKeyTyped(java.awt.event.KeyEvent evt) { if(t_sin.getText().length()>249){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isLetter(tecla) && tecla != KeyEvent.VK_SPACE && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); getToolkit().beep(); } } /** * @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(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

Page 49: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Ciudad().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton b_modificar; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JPopupMenu jPopupMenu1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextField t_cla; private javax.swing.JTable t_datos; private javax.swing.JTextField t_dur; private javax.swing.JTextField t_gen; private javax.swing.JLabel t_idp; private javax.swing.JTextArea t_sin; private javax.swing.JTextField t_tit; // End of variables declaration }

Clase: Eliminar.java

Page 50: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

import java.awt.event.KeyEvent; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; public class Eliminarpax extends javax.swing.JFrame { DefaultTableModel model; public Eliminarpax() { initComponents(); setLocationRelativeTo(null); setResizable(false); setTitle("Eliminar Pelicula Plaza Americas Xalapa"); cargar(); } void cargar(){ String [] titulos={"Codigo","Titulo","Genero","Clasificación","Duración","Sinopsis"}; String [] registros = new String[6]; String sql = "SELECT * FROM pelicula"; model = new DefaultTableModel(null,titulos); conectar cc=new conectar(); Connection cn = cc.conexion(); Statement st; try { st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ registros[0]=rs.getString("idpelicula"); registros[1]=rs.getString("titulo"); registros[2]=rs.getString("genero"); registros[3]=rs.getString("clasificacion"); registros[4]=rs.getString("duracion"); registros[5]=rs.getString("sinopsis"); model.addRow(registros); } t_datos.setModel(model); } catch (SQLException ex) {

Page 51: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

JOptionPane.showMessageDialog(null, ex); } } /** * 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"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); t_datos = new javax.swing.JTable(); t_idp = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(0, 0, 153)); setPreferredSize(new java.awt.Dimension(640, 620)); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\LOGO.png")); // NOI18N jLabel2.setFont(new java.awt.Font("Calibri", 1, 48)); // NOI18N jLabel2.setText("CINEITSX"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("ELIMINAR"); jButton6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton6.setText("REGRESAR"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); t_datos.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {

Page 52: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

{}, {}, {}, {} }, new String [] { } )); jScrollPane1.setViewportView(t_datos); t_idp.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_idpKeyTyped(evt); } }); jLabel4.setText("ID Pelicula:"); jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton1.setText("ELIMINAR"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6)))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

Page 53: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(layout.createSequentialGroup() .addGap(164, 164, 164) .addComponent(jLabel1) .addGap(10, 10, 10) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(260, 260, 260) .addComponent(jLabel3)) .addGroup(layout.createSequentialGroup() .addGap(35, 35, 35) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(t_idp, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(t_idp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 113, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6) .addComponent(jButton1)) .addContainerGap()) ); pack(); }// </editor-fold> private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

Page 54: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if(t_idp.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa el ID Pelicula", "Error", JOptionPane.ERROR_MESSAGE); } else{ conectar cc=new conectar(); Connection cn = cc.conexion(); try{ String sql1="DELETE FROM funcion WHERE pelicula_idpelicula ='"+t_idp.getText()+"'"; String sql2="DELETE FROM traduccion WHERE pelicula_idpelicula ='"+t_idp.getText()+"'"; String sql3="DELETE FROM actua WHERE pelicula_idpelicula ='"+t_idp.getText()+"'"; String sql4="DELETE FROM pelicula WHERE idpelicula ='"+t_idp.getText()+"'"; PreparedStatement pst1 = cn.prepareStatement(sql1); pst1.executeUpdate(); PreparedStatement pst2 = cn.prepareStatement(sql2); pst2.executeUpdate(); PreparedStatement pst3 = cn.prepareStatement(sql3); pst3.executeUpdate(); PreparedStatement pst4 = cn.prepareStatement(sql4); pst4.executeUpdate(); JOptionPane.showMessageDialog(null,"Registro Eliminado con Exito"); }catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } cargar(); } } private void t_idpKeyTyped(java.awt.event.KeyEvent evt) { if(t_idp.getText().length()>2){ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isDigit(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume();

Page 55: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} } /** * @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(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Ciudad().setVisible(true); } }); }

Page 56: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable t_datos; private javax.swing.JTextField t_idp; // End of variables declaration }

Clase: Ventaboletos.java

import java.awt.event.KeyEvent; import java.sql.*; 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 Lizbeth */ public class Ventaboletopax extends javax.swing.JFrame { /** * Creates new form Ciudad */ public Ventaboletopax() { initComponents(); setLocationRelativeTo(null); setResizable(false); setTitle("Venta Boleto Plaza Americas Xalapa"); bloquear(); cargarFunciones(); } void cargarFunciones(){ this.comboFuncion.removeAllItems();

Page 57: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

String sql = "SELECT * FROM funcion, sala, complejo, ciudad WHERE sala.idsala = sala_idsala and complejo.idcomplejo = complejo_idcomplejo and ciudad.idciudad = ciudad_idciudad and complejo.idcomplejo = 1 and ciudad.idciudad = 1"; conectar cc=new conectar(); Connection cn = cc.conexion(); Statement st; try { st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.comboFuncion.addItem(rs.getString("hora")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void cargarTitulos(){ this.comboTitulo.removeAllItems(); String hora = (String)comboFuncion.getSelectedItem(); //String funcion = this.comboFuncion.getSelectedItem().toString(); String sql = "select * from pelicula, funcion where funcion.hora = '"+ hora + "' and pelicula.idpelicula=funcion.pelicula_idpelicula"; //"select * from pelicula,funcion where idpelicula=pelicula.idpelicula and funcion.hora=\"14:30:00\"; conectar cc=new conectar(); Connection cn = cc.conexion(); Statement st; try { st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.comboTitulo.addItem(rs.getString("titulo")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void bloquear(){ jButton1.setEnabled(true); comboTitulo.setEnabled(false); t_nbol.setEnabled(false); jButton2.setEnabled(false); t_efe.setEnabled(false); jButton3.setEnabled(false); jButton7.setEnabled(false); }

Page 58: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

void desbloquear(){ comboTitulo.setEnabled(true); comboFuncion.setEnabled(true); } void costoBoleto(){ String nbol = t_nbol.getText(); t_cos.setText("50"); int numbol, cos, tot; numbol = Integer.parseInt(nbol); cos = 50; tot = numbol * cos; String total = String.valueOf(tot); t_tot.setText(total); } void cambioBoleto(){ String tot = t_tot.getText(); String efe = t_efe.getText(); int total, efectivo, cambio; total = Integer.parseInt(tot); efectivo = Integer.parseInt(efe); cambio = efectivo - total; String camb = String.valueOf(cambio); t_cam.setText(camb); } void cargaridFuncion(){ c_idf.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String hor = (String)comboFuncion.getSelectedItem(); String tit = (String)comboTitulo.getSelectedItem(); String sql="SELECT * FROM funcion, pelicula where hora= '"+ hor +"' and pelicula.idpelicula = pelicula_idpelicula and pelicula.titulo = '"+tit+"'"; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_idf.addItem(rs.getString("idfuncion")); } } catch (SQLException ex) {

Page 59: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

JOptionPane.showMessageDialog(null, ex); } } void cargarNumbutacas(){ c_nbu.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String idf = (String)c_idf.getSelectedItem(); String sql = "SELECT * FROM sala, funcion where complejo_idcomplejo=1 and funcion.idfuncion= "+ idf +" and funcion.sala_idsala = sala.idsala" ; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_nbu.addItem(rs.getString("numbutacas")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void cargarLugvendidos(){ c_lugv.removeAllItems(); conectar cc=new conectar(); Connection cn = cc.conexion(); String idf = (String)c_idf.getSelectedItem(); String sql = "select * from funcion where idfuncion='"+ idf +"'" ; try { Statement st = cn.createStatement(); ResultSet rs = st.executeQuery(sql); while(rs.next()){ this.c_lugv.addItem(rs.getString("lugvendidos")); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } } void comprarBoleto(){ conectar cc=new conectar(); Connection cn = cc.conexion();

Page 60: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

String idf = (String)c_idf.getSelectedItem(); String lugv = (String)c_lugv.getSelectedItem(); String nbu = (String)c_nbu.getSelectedItem(); String nbol = t_nbol.getText(); int lugaresvendidos, lugarescomprados, totalugv, numbutacas; lugarescomprados = Integer.parseInt(nbol); lugaresvendidos = Integer.parseInt(lugv); numbutacas = Integer.parseInt(nbu); totalugv = lugaresvendidos + lugarescomprados; if(totalugv>numbutacas){ JOptionPane.showMessageDialog(null, "Ya no hay lugares"); } else{ String sql = "UPDATE funcion SET lugvendidos='"+ totalugv +"' WHERE idfuncion='" +idf +"'"; try { PreparedStatement pst =cn.prepareStatement(sql); pst.executeUpdate(); JOptionPane.showMessageDialog(null, "Boletos comprados con exito"); bloquear(); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e); } } } /** * 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"> private void initComponents() { c_idf = new javax.swing.JComboBox(); c_nbu = new javax.swing.JComboBox(); c_lugv = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton6 = new javax.swing.JButton(); jButton7 = new javax.swing.JButton(); comboTitulo = new javax.swing.JComboBox();

Page 61: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

comboFuncion = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); t_nbol = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); t_cos = new javax.swing.JLabel(); t_tot = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); t_efe = new javax.swing.JTextField(); jLabel12 = new javax.swing.JLabel(); t_cam = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); c_idf.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); c_nbu.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); c_lugv.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(0, 0, 153)); jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Lizbeth\\OneDrive\\Documents\\TALLER DE BASES DE DATOS\\PROYECTO\\LOGO.png")); // NOI18N jLabel2.setFont(new java.awt.Font("Calibri", 1, 48)); // NOI18N jLabel2.setText("CINEITSX"); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel3.setText("BOLETO"); jButton6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jButton6.setText("CANCELAR"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jButton7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

Page 62: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jButton7.setText("COMPRAR"); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); comboTitulo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); comboFuncion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "------" })); comboFuncion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboFuncionActionPerformed(evt); } }); jLabel4.setText("Función:"); jLabel5.setText("Pelicula:"); jLabel6.setText("Num. boletos:"); t_nbol.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_nbolKeyTyped(evt); } }); jLabel7.setText("Costo:"); jLabel8.setText("Total:"); t_cos.setText("-"); t_tot.setText("-"); jLabel11.setText("Efectivo:"); t_efe.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { t_efeKeyTyped(evt); } }); jLabel12.setText("Cambio:"); t_cam.setText("-");

Page 63: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

jButton1.setText("OK"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("OK"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("OK"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jButton6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton7)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(164, 164, 164) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addGap(10, 10, 10) .addComponent(jLabel2)) .addGroup(layout.createSequentialGroup() .addGap(178, 178, 178) .addComponent(jLabel3)))) .addGroup(layout.createSequentialGroup()

Page 64: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGap(119, 119, 119) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel4) .addComponent(jLabel5) .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(t_nbol, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(62, 62, 62) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(comboFuncion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(comboTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addGap(52, 52, 52) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(t_cos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel8)) .addGroup(layout.createSequentialGroup() .addGap(66, 66, 66) .addComponent(t_tot, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel12) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

Page 65: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addComponent(t_efe) .addComponent(t_cam, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(23, 23, 23))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1) .addComponent(jButton2) .addComponent(jButton3)))) .addGap(0, 129, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(22, 22, 22) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel1) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addComponent(jLabel3) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(comboFuncion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(jButton1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(comboTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)) .addGap(28, 28, 28) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(jLabel7) .addComponent(jLabel8)) .addGap(4, 4, 4) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(t_nbol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(t_cos) .addComponent(t_tot) .addComponent(jButton2)) .addGap(22, 22, 22)

Page 66: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11) .addComponent(t_efe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(t_cam) .addComponent(jButton3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 80, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6) .addComponent(jButton7)) .addContainerGap()) ); pack(); }// </editor-fold> private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { Opplazaamericasx obj= new Opplazaamericasx(); obj.setVisible(true); dispose(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { desbloquear(); cargarTitulos(); comboTitulo.setEnabled(true); t_nbol.setEnabled(true); jButton2.setEnabled(true); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { if("00".equals(t_nbol.getText()) || "0".equals(t_nbol.getText()) || t_nbol.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa el Numero de Boletos", "Error", JOptionPane.ERROR_MESSAGE); } else{ costoBoleto(); t_efe.setEnabled(true); jButton3.setEnabled(true); } } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { if(t_efe.getText().isEmpty()){

Page 67: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

JOptionPane.showMessageDialog(null, "Ingresa el Efectivo", "Error", JOptionPane.ERROR_MESSAGE); } else{ if("00".equals(t_nbol.getText()) || "0".equals(t_nbol.getText()) || t_nbol.getText().isEmpty()){ JOptionPane.showMessageDialog(null, "Ingresa el Efectivo", "Error", JOptionPane.ERROR_MESSAGE); } else{ String total = t_tot.getText(); String efectivo = t_efe.getText(); int tota = Integer.parseInt(total); int efec = Integer.parseInt(efectivo); if(efec < tota){ JOptionPane.showMessageDialog(null, "Ingresa el Efectivo", "Error", JOptionPane.ERROR_MESSAGE); } else{ cambioBoleto(); jButton1.setEnabled(false); comboFuncion.setEnabled(false); comboTitulo.setEnabled(false); t_nbol.setEnabled(false); jButton2.setEnabled(false); t_efe.setEnabled(false); jButton3.setEnabled(false); jButton7.setEnabled(true); } } } } private void comboFuncionActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) { cargaridFuncion(); cargarNumbutacas(); cargarLugvendidos(); comprarBoleto(); desbloquear(); } private void t_nbolKeyTyped(java.awt.event.KeyEvent evt) { if(t_nbol.getText().length()>1){ evt.setKeyChar('\0');

Page 68: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

} char tecla; tecla=evt.getKeyChar(); if(!Character.isDigit(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); } } private void t_efeKeyTyped(java.awt.event.KeyEvent evt) { if(t_efe.getText().length()<4){ } else{ evt.setKeyChar('\0'); } char tecla; tecla=evt.getKeyChar(); if(!Character.isDigit(tecla) && tecla != KeyEvent.VK_BACK_SPACE){ evt.consume(); } } /** * @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(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) {

Page 69: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Ciudad.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Ciudad().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JComboBox c_idf; private javax.swing.JComboBox c_lugv; private javax.swing.JComboBox c_nbu; private javax.swing.JComboBox comboFuncion; private javax.swing.JComboBox comboTitulo; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel t_cam; private javax.swing.JLabel t_cos; private javax.swing.JTextField t_efe; private javax.swing.JTextField t_nbol; private javax.swing.JLabel t_tot; // End of variables declaration }

Page 70: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

MODELO ENTIDAD-RELACIÓN

Page 71: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

ciudad (idciudad, nombre)

complejo(idcomplejo, nombre, calle, col, cp, idciudad)

sala(idsala, numbutacas, numsala, idcomplejo, idciudad)

funcion(idfuncion, fecha, hora, lugvendidos, lugreservados, idpelicula, idsala, idcomplejo,

idciudad)

pelicula(idpelicula, titulo, genero, clasificación, duración, sinopsis, iddirector)

actua(idpelicula, idactor)

traduccion(idpelicula, idtipo)

tipo(idtipo, tipo)

actor(idactor, nombre, ap, am)

director(iddirector, nombre, ap, am)

reserva(idreserva, numreserva, pagado, idcliente, idfuncion, idpelicula, idsala, idcomplejo,

idciudad)

cliente(idcliente, nombre, ap, am, correo, numtarjeta)

empleado(idempleado, nombre, ap, am, correo, teléfono, calle, col, cp, ciudad, estado,

idcomplejo, idciudad)

usuario(idusuario, usuario, contrasena, idempleado)

ESQUEMA DE LA BASE DE DATOS

Page 72: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

DICCIONARIO DE DATOS

funcion

ciudad

complejo

sala

Page 73: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

pelicula

tipo

actor

director

reserva

Page 74: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

cliente

empleado

usuario

Page 75: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

MODELO RELACIONAL

Page 76: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX

ESPECIFICACIONES DEL SMBD

SMBD: MySQL Workbench

VERSIÓN: 6.1

PLATAFORMA: Microsoft Windows (x86, 32-bit)

TAMAÑO: 31.8M

DESCARGA: http://dev.mysql.com/downloads/workbench/

Page 77: Manual técnico CINEITSX

MANUAL TÉCNICO CINEITSX