Sunteți pe pagina 1din 5

package Obj_Matricula; import Matriculados.Matriculados; import javax.swing.JOptionPane; public class Obj_Matricula extends javax.swing.

JFrame { Matriculados objMatriculados= new Matriculados(); public Obj_Matricula() { initComponents(); setLocationRelativeTo(null); Estado_Controles(false); Estado_Botones(true); } private void Estado_Controles(boolean Estado ) { FxtApellido.setEditable(Estado); FxtNombre.setEditable(Estado); } private void Estado_Botones(boolean Estado) { BtnRegistar.setEnabled(Estado); BtnRecuperar.setEnabled(Estado); } private void Registar_Controles(){ objMatriculados.setApellidos(FxtApellido.getText()); objMatriculados.setNombres(FxtNombre.getText()); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); BtnRegistar = new javax.swing.JButton(); BtnRecuperar = new javax.swing.JButton(); FxtApellido = new javax.swing.JTextField(); FxtNombre = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); BtnSalir = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "MA TRICULA", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorde r.DEFAULT_POSITION, new java.awt.Font("Comic Sans MS", 0, 24))); // NOI18N

BtnRegistar.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N BtnRegistar.setText("Registrar"); BtnRegistar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnRegistarActionPerformed(evt); } }); BtnRecuperar.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N BtnRecuperar.setText("Recuperar"); BtnRecuperar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnRecuperarActionPerformed(evt); } }); FxtApellido.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N FxtNombre.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel1.setText("Apellido:"); jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel2.setText("Nombre:"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPan el1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment. LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLay out.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel 1Layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem ent.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(FxtApellido, javax.swing.GroupLayout.PREFE RRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel 1Layout.createSequentialGroup() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem ent.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(FxtNombre, javax.swing.GroupLayout.PREFERR ED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLay out.Alignment.LEADING, false) .addComponent(BtnRecuperar, javax.swing.GroupLayout.DEFAULT_ SIZE, 150, Short.MAX_VALUE) .addComponent(BtnRegistar, javax.swing.GroupLayout.DEFAULT_S IZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment. LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLay out.Alignment.BASELINE) .addComponent(BtnRegistar) .addComponent(FxtApellido) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA TED, 64, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLay out.Alignment.BASELINE) .addComponent(BtnRecuperar) .addComponent(FxtNombre) .addComponent(jLabel2)) .addGap(13, 13, 13)) ); BtnSalir.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N BtnSalir.setText("Salir"); BtnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { BtnSalirActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentP ane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING ) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, j avax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGap(160, 160, 160) .addComponent(BtnSalir)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING ) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, j avax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA TED, 18, Short.MAX_VALUE) .addComponent(BtnSalir) .addContainerGap()) ); pack(); }// </editor-fold> private void BtnRegistarActionPerformed(java.awt.event.ActionEvent evt) { String a = FxtApellido.getText();

String b = FxtNombre.getText(); } private void BtnRecuperarActionPerformed(java.awt.event.ActionEvent evt) {

} private void BtnSalirActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } /** * @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 cod e (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the d efault look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lo okandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIMana ger.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Obj_Matricula.class.getName()).lo g(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Obj_Matricula.class.getName()).lo g(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Obj_Matricula.class.getName()).lo g(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Obj_Matricula.class.getName()).lo g(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Obj_Matricula().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton BtnRecuperar;

private javax.swing.JButton BtnRegistar; private javax.swing.JButton BtnSalir; private javax.swing.JTextField FxtApellido; private javax.swing.JTextField FxtNombre; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; // End of variables declaration }

S-ar putea să vă placă și