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

/*
 * jfrmMovimientosCuentas.java
 *
 * Created on 11-dic-2009, 12:30:48
 */

package BBUVAJAVA;

import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.ListSelectionModel;

/**
 *
 * @author Agustin
 */
public class jfrmMovimientosCuentas extends javax.swing.JFrame {

    Sucursal auxsuc;
     JFrame auxjf;
     Producto prin;
    /** Creates new form MovimientosCuenta */
    public jfrmMovimientosCuentas(Sucursal suc, JFrame ppal,Producto p) {
        initComponents();
        auxsuc=suc;
        auxjf=ppal;
        prin=p;
        ArrayList<Movimiento> a=p.getMovimiento();
        DefaultListModel dlm = new DefaultListModel();
        jlstMovimientos.setModel(dlm);
        jlstMovimientos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        Iterator iterador = a.listIterator();

        while( iterador.hasNext() ) {
            Movimiento m = (Movimiento) iterador.next();
            dlm.addElement(m.getFechaOperacion()+"  "+m.getImporte());
        }
    }

    /** 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() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jlstMovimientos = new javax.swing.JList();
        jLabel1 = new javax.swing.JLabel();
        jbtnCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);

        jlstMovimientos.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jlstMovimientos);

        jLabel1.setText("Movimientos de una cuenta");

        jbtnCancelar.setText("Salir");
        jbtnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnCancelarActionPerformed(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()
                .addGap(29, 29, 29)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
                .addGap(106, 106, 106)
                .addComponent(jbtnCancelar)
                .addGap(23, 23, 23))
            .addGroup(layout.createSequentialGroup()
                .addGap(133, 133, 133)
                .addComponent(jLabel1)
                .addContainerGap(136, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(39, 39, 39))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(201, Short.MAX_VALUE)
                .addComponent(jbtnCancelar)
                .addGap(76, 76, 76))
        );

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

    private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnCancelarActionPerformed
        auxjf.setEnabled(true);
        this.dispose();
}//GEN-LAST:event_jbtnCancelarActionPerformed

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtnCancelar;
    private javax.swing.JList jlstMovimientos;
    // End of variables declaration//GEN-END:variables

}
