Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Sidney Castro
Added: Oct 9, 2018 2:14 PM
Views: 4
Tags: no tags
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package gui;
  7.  
  8. import java.sql.Connection;
  9.  
  10. /**
  11.  *
  12.  * @author Sidney
  13.  */
  14. public class Menu extends javax.swing.JFrame {
  15.  
  16.     Connection con;
  17.  
  18.     public Menu(Connection con) {
  19.         initComponents();
  20.         this.con = con;
  21.     }
  22.  
  23.     public Menu() {
  24.         initComponents();
  25.     }
  26.  
  27.     /**
  28.      * This method is called from within the constructor to initialize the form.
  29.      * WARNING: Do NOT modify this code. The content of this method is always
  30.      * regenerated by the Form Editor.
  31.      */
  32.     @SuppressWarnings("unchecked")
  33.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  34.     private void initComponents() {
  35.  
  36.         jMenuBar1 = new javax.swing.JMenuBar();
  37.         jMenu1 = new javax.swing.JMenu();
  38.         jMenuItem1 = new javax.swing.JMenuItem();
  39.         jMenu2 = new javax.swing.JMenu();
  40.  
  41.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  42.  
  43.         jMenu1.setText("File");
  44.  
  45.         jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
  46.         jMenuItem1.setText("Aluno");
  47.         jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
  48.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  49.                 jMenuItem1ActionPerformed(evt);
  50.             }
  51.         });
  52.         jMenu1.add(jMenuItem1);
  53.  
  54.         jMenuBar1.add(jMenu1);
  55.  
  56.         jMenu2.setText("Edit");
  57.         jMenuBar1.add(jMenu2);
  58.  
  59.         setJMenuBar(jMenuBar1);
  60.  
  61.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  62.         getContentPane().setLayout(layout);
  63.         layout.setHorizontalGroup(
  64.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  65.             .addGap(0, 400, Short.MAX_VALUE)
  66.         );
  67.         layout.setVerticalGroup(
  68.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  69.             .addGap(0, 279, Short.MAX_VALUE)
  70.         );
  71.  
  72.         pack();
  73.     }// </editor-fold>                        
  74.  
  75.     private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  76.         AlunoGUI alunoGUI = new AlunoGUI(con);
  77.         alunoGUI.setVisible(true);
  78.     }                                          
  79.  
  80.     /**
  81.      * @param args the command line arguments
  82.      */
  83.     public static void main(String args[]) {
  84.         /* Set the Nimbus look and feel */
  85.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  86.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  87.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  88.          */
  89.         try {
  90.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  91.                 if ("Nimbus".equals(info.getName())) {
  92.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  93.                     break;
  94.                 }
  95.             }
  96.         } catch (ClassNotFoundException ex) {
  97.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  98.         } catch (InstantiationException ex) {
  99.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  100.         } catch (IllegalAccessException ex) {
  101.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  102.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  103.             java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  104.         }
  105.         //</editor-fold>
  106.  
  107.         /* Create and display the form */
  108.         java.awt.EventQueue.invokeLater(new Runnable() {
  109.             public void run() {
  110.                 new Menu().setVisible(true);
  111.             }
  112.         });
  113.     }
  114.  
  115.     // Variables declaration - do not modify                    
  116.     private javax.swing.JMenu jMenu1;
  117.     private javax.swing.JMenu jMenu2;
  118.     private javax.swing.JMenuBar jMenuBar1;
  119.     private javax.swing.JMenuItem jMenuItem1;
  120.     // End of variables declaration                  
  121. }
  122.