/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * jfrmNuevaCuenta2.java
 *
 * Created on 25-nov-2009, 22:23:21
 */

package bbuvajava;

import java.util.ArrayList;
import javax.swing.JFrame;

/**
 *
 * @author Administrador
 */
public class jfrmNuevaCuenta2 extends javax.swing.JFrame {
    Sucursal AuxSuc;
    CuentaCorriente cuenta;
    JFrame formularioPPal;
    ArrayList<Titular> titulares=new ArrayList();

    /** Creates new form jfrmNuevaCuenta2 */
    public jfrmNuevaCuenta2(Sucursal suc, CuentaCorriente p,JFrame form) {
        AuxSuc=suc;
        formularioPPal=form;
        cuenta=p;
        initComponents();

        jlblNumCuenta.setText(p.getNumeroCuenta());
    }

    /** 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">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jlblNumCuenta = new javax.swing.JLabel();
        jbtnAñadirTitular = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jbtnCancelar = new javax.swing.JButton();
        jbtnAtras = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel1.setText("PRODUCTOS - CUENTA CORRIENTE");

        jLabel2.setText("Numero de Cuenta: ");

        jbtnAñadirTitular.setText("Añadir Titular");
        jbtnAñadirTitular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAñadirTitularActionPerformed(evt);
            }
        });

        jLabel3.setText("La Cuenta Corriente aún no tiene ningún titular. Por favor, añada el/los titulares.");

        jbtnCancelar.setText("Cancelar");
        jbtnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCancelarActionPerformed(evt);
            }
        });

        jbtnAtras.setText("<<Atras");
        jbtnAtras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnAtrasActionPerformed(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(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(18, 18, 18)
                                .addComponent(jlblNumCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel3)
                            .addComponent(jbtnAñadirTitular))))
                .addContainerGap(65, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(330, Short.MAX_VALUE)
                .addComponent(jbtnAtras)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtnCancelar)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jlblNumCuenta))
                .addGap(18, 18, 18)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jbtnAñadirTitular)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnCancelar)
                    .addComponent(jbtnAtras))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCancelarActionPerformed
        // TODO add your handling code here:
      formularioPPal.setEnabled(true);
      this.dispose();
}//GEN-LAST:event_jbtnCancelarActionPerformed

    private void jbtnAtrasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAtrasActionPerformed
        // TODO add your handling code here:
        
        new jfrmNuevaCuenta(AuxSuc,formularioPPal).setVisible(true);
        this.dispose();
}//GEN-LAST:event_jbtnAtrasActionPerformed

    private void jbtnAñadirTitularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnAñadirTitularActionPerformed
        // TODO add your handling code here:
        
        new jfrmAñadirTitular(AuxSuc,cuenta,titulares,formularioPPal).setVisible(true);
        this.dispose();
    }//GEN-LAST:event_jbtnAñadirTitularActionPerformed

    /**
    * @param args the command line arguments
    */
    /*
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new jfrmNuevaCuenta2().setVisible(true);
            }
        });
    }*/

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JButton jbtnAtras;
    private javax.swing.JButton jbtnAñadirTitular;
    private javax.swing.JButton jbtnCancelar;
    private javax.swing.JLabel jlblNumCuenta;
    // End of variables declaration//GEN-END:variables

}
