Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package manejoVentanasEstudiantes;
  2.  
  3. /**
  4.  *
  5.  * @author Rafa
  6.  */
  7. public class ventanaPrincipal extends javax.swing.JFrame {
  8.     private GestorEstudiante estudiantes;
  9.    
  10.    
  11.     /**
  12.      * Creates new form ventanaPrincipal
  13.      */
  14.     public ventanaPrincipal() {
  15.         initComponents();
  16.         estudiantes = new GestorEstudiante();
  17.     }
  18.  
  19.     /**
  20.      * This method is called from within the constructor to initialize the form.
  21.      * WARNING: Do NOT modify this code. The content of this method is always
  22.      * regenerated by the Form Editor.
  23.      */
  24.     @SuppressWarnings("unchecked")
  25.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  26.     private void initComponents() {
  27.  
  28.         jMenuBar1 = new javax.swing.JMenuBar();
  29.         jMenu1 = new javax.swing.JMenu();
  30.         jMenuItem1 = new javax.swing.JMenuItem();
  31.         jMenu2 = new javax.swing.JMenu();
  32.         jMenuItem2 = new javax.swing.JMenuItem();
  33.         jMenuItem3 = new javax.swing.JMenuItem();
  34.  
  35.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  36.  
  37.         jMenu1.setText("Archivo");
  38.  
  39.         jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
  40.         jMenuItem1.setText("Salir");
  41.         jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
  42.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  43.                 jMenuItem1ActionPerformed(evt);
  44.             }
  45.         });
  46.         jMenu1.add(jMenuItem1);
  47.  
  48.         jMenuBar1.add(jMenu1);
  49.  
  50.         jMenu2.setText("Edicion");
  51.  
  52.         jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
  53.         jMenuItem2.setText("Agregar Estudiante");
  54.         jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
  55.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  56.                 jMenuItem2ActionPerformed(evt);
  57.             }
  58.         });
  59.         jMenu2.add(jMenuItem2);
  60.  
  61.         jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK));
  62.         jMenuItem3.setText("Listar Estudiantes");
  63.         jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
  64.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  65.                 jMenuItem3ActionPerformed(evt);
  66.             }
  67.         });
  68.         jMenu2.add(jMenuItem3);
  69.  
  70.         jMenuBar1.add(jMenu2);
  71.  
  72.         setJMenuBar(jMenuBar1);
  73.  
  74.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  75.         getContentPane().setLayout(layout);
  76.         layout.setHorizontalGroup(
  77.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  78.             .addGap(0, 400, Short.MAX_VALUE)
  79.         );
  80.         layout.setVerticalGroup(
  81.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  82.             .addGap(0, 279, Short.MAX_VALUE)
  83.         );
  84.  
  85.         pack();
  86.     }// </editor-fold>                        
  87.  
  88.     private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  89.         this.dispose();
  90.     }                                          
  91.  
  92.     private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  93.         ventanaAgregarEstudiante vAgregar = new ventanaAgregarEstudiante(this, true);
  94.         vAgregar.setEstudiantes(estudiantes);
  95.         vAgregar.setVisible(true);
  96.     }                                          
  97.  
  98.     private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  99.         ventanaListarEstudiantes vListar = new ventanaListarEstudiantes(this, true);
  100.         vListar.setEstudiantes(estudiantes);
  101.         vListar.llenarDatosTabla();
  102.         vListar.setVisible(true);
  103.     }                                          
  104.  
  105.     /**
  106.      * @param args the command line arguments
  107.      */
  108.     public static void main(String args[]) {
  109.         /*
  110.          * Set the Nimbus look and feel
  111.          */
  112.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  113.         /*
  114.          * If Nimbus (introduced in Java SE 6) is not available, stay with the
  115.          * default look and feel. For details see
  116.          * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  117.          */
  118.         try {
  119.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  120.                 if ("Nimbus".equals(info.getName())) {
  121.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  122.                     break;
  123.                 }
  124.             }
  125.         } catch (ClassNotFoundException ex) {
  126.             java.util.logging.Logger.getLogger(ventanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  127.         } catch (InstantiationException ex) {
  128.             java.util.logging.Logger.getLogger(ventanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  129.         } catch (IllegalAccessException ex) {
  130.             java.util.logging.Logger.getLogger(ventanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  131.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  132.             java.util.logging.Logger.getLogger(ventanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  133.         }
  134.         //</editor-fold>
  135.  
  136.         /*
  137.          * Create and display the form
  138.          */
  139.         java.awt.EventQueue.invokeLater(new Runnable() {
  140.  
  141.             public void run() {
  142.                 new ventanaPrincipal().setVisible(true);
  143.             }
  144.         });
  145.     }
  146.     // Variables declaration - do not modify                    
  147.     private javax.swing.JMenu jMenu1;
  148.     private javax.swing.JMenu jMenu2;
  149.     private javax.swing.JMenuBar jMenuBar1;
  150.     private javax.swing.JMenuItem jMenuItem1;
  151.     private javax.swing.JMenuItem jMenuItem2;
  152.     private javax.swing.JMenuItem jMenuItem3;
  153.     // End of variables declaration                  
  154. }