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 7, 2018 6:21 PM
Modified: Oct 7, 2018 9:01 PM
Views: 6
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 AlunoGUI extends javax.swing.JFrame {
  15.  
  16.     /**
  17.      * Creates new form AlunoGUI
  18.      */
  19.    
  20.     Connection con;
  21.    
  22.     public AlunoGUI(Connection con) {
  23.         initComponents();
  24.         this.con = con;
  25.     }
  26.    
  27.     public AlunoGUI() {
  28.         initComponents();
  29.     }
  30.  
  31.     /**
  32.      * This method is called from within the constructor to initialize the form.
  33.      * WARNING: Do NOT modify this code. The content of this method is always
  34.      * regenerated by the Form Editor.
  35.      */
  36.     @SuppressWarnings("unchecked")
  37.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  38.     private void initComponents() {
  39.  
  40.         jLabel1 = new javax.swing.JLabel();
  41.         jLabel2 = new javax.swing.JLabel();
  42.         jTextField1 = new javax.swing.JTextField();
  43.         jTextField2 = new javax.swing.JTextField();
  44.         jScrollPane1 = new javax.swing.JScrollPane();
  45.         jList1 = new javax.swing.JList<>();
  46.         jButton1 = new javax.swing.JButton();
  47.  
  48.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  49.  
  50.         jLabel1.setText("ID:");
  51.  
  52.         jLabel2.setText("Nome:");
  53.  
  54.         jTextField1.setText("jTextField1");
  55.  
  56.         jTextField2.setText("jTextField2");
  57.  
  58.         jScrollPane1.setViewportView(jList1);
  59.  
  60.         jButton1.setText("Gravar");
  61.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  62.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  63.                 jButton1ActionPerformed(evt);
  64.             }
  65.         });
  66.  
  67.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  68.         getContentPane().setLayout(layout);
  69.         layout.setHorizontalGroup(
  70.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  71.             .addGroup(layout.createSequentialGroup()
  72.                 .addGap(24, 24, 24)
  73.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  74.                     .addGroup(layout.createSequentialGroup()
  75.                         .addComponent(jLabel1)
  76.                         .addGap(18, 18, 18)
  77.                         .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  78.                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  79.                         .addComponent(jButton1)
  80.                         .addGroup(layout.createSequentialGroup()
  81.                             .addComponent(jLabel2)
  82.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  83.                             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  84.                                 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
  85.                                 .addComponent(jTextField1)))))
  86.                 .addContainerGap(37, Short.MAX_VALUE))
  87.         );
  88.         layout.setVerticalGroup(
  89.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  90.             .addGroup(layout.createSequentialGroup()
  91.                 .addContainerGap()
  92.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  93.                     .addComponent(jLabel1)
  94.                     .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  95.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  96.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  97.                     .addComponent(jLabel2)
  98.                     .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  99.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  100.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  101.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
  102.                 .addComponent(jButton1)
  103.                 .addContainerGap())
  104.         );
  105.  
  106.         pack();
  107.     }// </editor-fold>                        
  108.  
  109.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  110.         // TODO add your handling code here:
  111.     }                                        
  112.  
  113.     /**
  114.      * @param args the command line arguments
  115.      */
  116.     public static void main(String args[]) {
  117.         /* Set the Nimbus look and feel */
  118.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  119.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  120.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  121.          */
  122.         try {
  123.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  124.                 if ("Nimbus".equals(info.getName())) {
  125.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  126.                     break;
  127.                 }
  128.             }
  129.         } catch (ClassNotFoundException ex) {
  130.             java.util.logging.Logger.getLogger(AlunoGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  131.         } catch (InstantiationException ex) {
  132.             java.util.logging.Logger.getLogger(AlunoGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  133.         } catch (IllegalAccessException ex) {
  134.             java.util.logging.Logger.getLogger(AlunoGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  135.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  136.             java.util.logging.Logger.getLogger(AlunoGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  137.         }
  138.         //</editor-fold>
  139.  
  140.         /* Create and display the form */
  141.         java.awt.EventQueue.invokeLater(new Runnable() {
  142.             public void run() {
  143.                 new AlunoGUI().setVisible(true);
  144.             }
  145.         });
  146.     }
  147.  
  148.     // Variables declaration - do not modify                    
  149.     private javax.swing.JButton jButton1;
  150.     private javax.swing.JLabel jLabel1;
  151.     private javax.swing.JLabel jLabel2;
  152.     private javax.swing.JList<String> jList1;
  153.     private javax.swing.JScrollPane jScrollPane1;
  154.     private javax.swing.JTextField jTextField1;
  155.     private javax.swing.JTextField jTextField2;
  156.     // End of variables declaration                  
  157. }
  158.