<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaUsuario;

import ec.edu.ups.controlador.ControladorUsuario;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 *
 * @author dduta
 */
public class EditarUsuario extends javax.swing.JInternalFrame {

    private ControladorUsuario controladoUsuario;
    private Locale localizacion;
    private ResourceBundle mensajes;

    /**
     * Creates new form EditarUsuario
     */
    public EditarUsuario(ControladorUsuario controladoUsuario) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladoUsuario = controladoUsuario;
    }

    public void limpiar() {
        contrasenia.setText("");
        txtApellidoActualizarU.setText("");
        txtCedulaU.setText("");
        txtCorreoActualizarU.setText("");
        txtNombreActualizarU.setText("");
        txtTipoActualizarU.setText("");
        txtcu.setText("");
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
        mensajes = ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        lebelUsuarioEditar.setText(mensajes.getString("lebelUsuarioEditar"));
        ButtonBuscarU.setText(mensajes.getString("ButtonBuscarU"));
        Labesuariol.setText(mensajes.getString("Labesuariol"));
        tipo.setText(mensajes.getString("tipo"));
        nombre.setText(mensajes.getString("nombre"));
        apellido.setText(mensajes.getString("apellido"));
        correo.setText(mensajes.getString("correo"));
        contrasenia.setText(mensajes.getString("contrasenia"));
        ButtonActualizarU.setText(mensajes.getString("ButtonActualizarU"));
        jButton1.setText(mensajes.getString("jButton1"));
    }

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

        lebelUsuarioEditar = new javax.swing.JLabel();
        Labesuariol = new javax.swing.JLabel();
        tipo = new javax.swing.JLabel();
        nombre = new javax.swing.JLabel();
        apellido = new javax.swing.JLabel();
        ButtonBuscarU = new javax.swing.JButton();
        ButtonActualizarU = new javax.swing.JButton();
        txtCedulaU = new javax.swing.JTextField();
        correo = new javax.swing.JLabel();
        txtTipoActualizarU = new javax.swing.JTextField();
        txtApellidoActualizarU = new javax.swing.JTextField();
        txtNombreActualizarU = new javax.swing.JTextField();
        txtCorreoActualizarU = new javax.swing.JTextField();
        contrasenia = new javax.swing.JLabel();
        txtcu = new javax.swing.JPasswordField();
        jButton1 = new javax.swing.JButton();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Editar Usuarios");

        lebelUsuarioEditar.setText("Ingrese la Cedula del Usuario a Editar:");

        Labesuariol.setText("Ingrese los nuevos Datos");

        tipo.setText("Tipo:");

        nombre.setText("Nombre:");

        apellido.setText("Apellido:");

        ButtonBuscarU.setText("Buscar");
        ButtonBuscarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBuscarUActionPerformed(evt);
            }
        });

        ButtonActualizarU.setText("Actualizar");
        ButtonActualizarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonActualizarUActionPerformed(evt);
            }
        });

        correo.setText("Correo:");

        txtTipoActualizarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtTipoActualizarUActionPerformed(evt);
            }
        });

        contrasenia.setText("contraseña");

        jButton1.setText("Cancelar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(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()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(lebelUsuarioEditar)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtCedulaU, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(Labesuariol)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(143, 143, 143)
                        .addComponent(ButtonBuscarU))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(84, 84, 84)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(nombre)
                                    .addComponent(tipo)
                                    .addComponent(apellido)
                                    .addComponent(correo))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtTipoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtApellidoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtNombreActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtCorreoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(4, 4, 4)
                                .addComponent(contrasenia)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtcu))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ButtonActualizarU)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)
                        .addGap(78, 78, 78)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lebelUsuarioEditar)
                    .addComponent(txtCedulaU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ButtonBuscarU)
                .addGap(14, 14, 14)
                .addComponent(Labesuariol)
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tipo)
                    .addComponent(txtTipoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nombre)
                    .addComponent(txtNombreActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(apellido)
                    .addComponent(txtApellidoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(correo)
                    .addComponent(txtCorreoActualizarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(contrasenia)
                    .addComponent(txtcu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonActualizarU)
                    .addComponent(jButton1))
                .addContainerGap(56, Short.MAX_VALUE))
        );

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

    private void txtTipoActualizarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTipoActualizarUActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtTipoActualizarUActionPerformed

    private void ButtonActualizarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonActualizarUActionPerformed
        if (!txtApellidoActualizarU.getText().isEmpty() && !txtTipoActualizarU.getText().isEmpty() && !txtCorreoActualizarU.getText().isEmpty() && !txtNombreActualizarU.getText().isEmpty() && !txtcu.getText().isEmpty()) {
            controladoUsuario.update(txtTipoActualizarU.getText(), txtCedulaU.getText(), txtNombreActualizarU.getText(), txtApellidoActualizarU.getText(), txtCorreoActualizarU.getText(), txtcu.getText());
            limpiar();
        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }
    }//GEN-LAST:event_ButtonActualizarUActionPerformed

    private void ButtonBuscarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBuscarUActionPerformed
        if (!txtCedulaU.getText().isEmpty()) {
            if (controladoUsuario.read(txtCedulaU.getText()) != null) {
                txtTipoActualizarU.setText(controladoUsuario.read(txtCedulaU.getText()).getTipo());
                txtNombreActualizarU.setText(controladoUsuario.read(txtCedulaU.getText()).getNombre());
                txtApellidoActualizarU.setText(controladoUsuario.read(txtCedulaU.getText()).getApellido());
                txtCorreoActualizarU.setText(controladoUsuario.read(txtCedulaU.getText()).getCorreo());
                txtcu.setText(controladoUsuario.read(txtCedulaU.getText()).getContrasenia());

            } else {
                JOptionPane.showMessageDialog(null, "No existe el Usuario");
                limpiar();
            }
        } else {
            JOptionPane.showMessageDialog(null, "Campo buscar Uusuario vacio");
        }
    }//GEN-LAST:event_ButtonBuscarUActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        this.setVisible(false);
    }//GEN-LAST:event_jButton1ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonActualizarU;
    private javax.swing.JButton ButtonBuscarU;
    private javax.swing.JLabel Labesuariol;
    private javax.swing.JLabel apellido;
    private javax.swing.JLabel contrasenia;
    private javax.swing.JLabel correo;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel lebelUsuarioEditar;
    private javax.swing.JLabel nombre;
    private javax.swing.JLabel tipo;
    private javax.swing.JTextField txtApellidoActualizarU;
    private javax.swing.JTextField txtCedulaU;
    private javax.swing.JTextField txtCorreoActualizarU;
    private javax.swing.JTextField txtNombreActualizarU;
    private javax.swing.JTextField txtTipoActualizarU;
    private javax.swing.JPasswordField txtcu;
    // End of variables declaration//GEN-END:variables
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.dao;

import ec.edu.ups.modelo.Usuario;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
import ec.edu.ups.idao.IdaoUsuario;

/**
 *
 * @author dduta
 */
public class DaoUsuario implements IdaoUsuario{
    
    private Map<String, Usuario> diccionario;
    
    public DaoUsuario() {
        this.diccionario = new HashMap<String,Usuario>();
        
    }
    @Override
    public void create(Usuario usuario) {
        diccionario.put(usuario.getId(), usuario );
    }

    @Override
    public Usuario read(String id) {
      return diccionario.get(id);
    }

    @Override
    public void update(Usuario usuario) {
        diccionario.put(usuario.getId(), usuario);
    }

    @Override
    public void delete(Usuario usuario) {
        diccionario.remove(usuario.getId());
    }
    
    @Override
    public Usuario validar(String correo, String contrasenia) {
        Collection <Usuario> usuarios=diccionario.values();
        for (Usuario usuario : usuarios) {
            if (usuario.getCorreo().equals(correo) && usuario.getContrasenia().equals(contrasenia)) {
                return usuario;
            }else{
                  System.out.println("Usuario no existente");
                }
        }
        return null;
    }

    @Override
    public Collection<Usuario> findAll() {
        Collection<Usuario> usuarios = diccionario.values();
        return usuarios;
    }  
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaUsuario;

import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
import ec.edu.ups.controlador.ControladorUsuario;
import ec.edu.ups.modelo.Usuario;
import java.util.Collection;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

/**
 *
 * @author dduta
 */
public class ListarUsuarios extends javax.swing.JInternalFrame {

    private ControladorUsuario controladorUsuario;
    private Locale localizacion;
    private ResourceBundle mensajes;
    private String cedula;
    private String nombre;
    private String apellido;
    private String correo;
    private String tipo;

    /**
     * Creates new form ListarUsuarios
     */
    public ListarUsuarios(ControladorUsuario controladorUsuario) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladorUsuario = controladorUsuario;
    }

    public void actalizar(Collection<Usuario> usuarios) {
        DefaultTableModel modelo = (DefaultTableModel) TablaListarU.getModel();
        modelo.setRowCount(0);
        for (Usuario usuario : usuarios) {
            Object[] fila = new Object[4];
            fila[0] = usuario.getId();
            fila[1] = usuario.getNombre();
            fila[2] = usuario.getApellido();
            fila[3] = usuario.getTipo();
        }
        TablaListarU.setModel(modelo);
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
        mensajes = ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        ButtonListarU.setText(mensajes.getString("ButtonListarU"));
        ButtonCancelarU.setText(mensajes.getString("ButtonCancelarU"));
        
        this.cedula = mensajes.getString("cedula");
        this.nombre = mensajes.getString("nombre");
        this.apellido = mensajes.getString("apellido");
        this.correo = mensajes.getString("correo");
        this.tipo = mensajes.getString("tipo");
        
        DefaultTableModel modelo = (DefaultTableModel) TablaListarU.getModel();
        modelo.setColumnCount(0);
        modelo.setRowCount(0);
        modelo.addColumn(cedula);
        modelo.addColumn(nombre);
        modelo.addColumn(apellido);
        modelo.addColumn(correo);
        modelo.addColumn(tipo);
        this.TablaListarU.setModel(modelo);
    }
     public void limpiarTblLista() {
       TablaListarU.removeAll();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jInternalFrame1 = new javax.swing.JInternalFrame();
        jScrollPane1 = new javax.swing.JScrollPane();
        TablaListarU = new javax.swing.JTable();
        ButtonListarU = new javax.swing.JButton();
        ButtonCancelarU = new javax.swing.JButton();

        jInternalFrame1.setVisible(true);

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Ventana Listar Usuario");

        TablaListarU.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Cedula", "Nombre", "Apellido", "Correo", "Tipo"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(TablaListarU);

        ButtonListarU.setText("Listar");
        ButtonListarU.setToolTipText("Dale push para lista los USUARIOSr");
        ButtonListarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonListarUActionPerformed(evt);
            }
        });

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

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 660, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(154, 154, 154)
                .addComponent(ButtonListarU, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(49, 49, 49)
                .addComponent(ButtonCancelarU, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonListarU)
                    .addComponent(ButtonCancelarU))
                .addContainerGap(62, Short.MAX_VALUE))
        );

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

    private void ButtonListarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonListarUActionPerformed
        Collection<Usuario> listaUsuarios = controladorUsuario.findAll();
        DefaultTableModel modelo = (DefaultTableModel) TablaListarU.getModel();
        modelo.setRowCount(0);
        for (Usuario usuario : listaUsuarios) {
            Object[] rowData = {usuario.getId(), usuario.getNombre(), usuario.getApellido(), usuario.getCorreo(), usuario.getTipo()};
            modelo.addRow(rowData);
        }
    }//GEN-LAST:event_ButtonListarUActionPerformed

    private void ButtonCancelarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCancelarUActionPerformed
        limpiarTblLista();
        this.setVisible(false);
    }//GEN-LAST:event_ButtonCancelarUActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonCancelarU;
    private javax.swing.JButton ButtonListarU;
    private javax.swing.JTable TablaListarU;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.idao;

import ec.edu.ups.modelo.Usuario;
import java.util.Collection;

/**
 *
 * @author dduta
 */
public interface IdaoUsuario {
    public void create(Usuario usuario);
    public Usuario read(String cedula);
    public void update (Usuario usuario);
    public void delete (Usuario usuario);
    public Usuario validar(String correo, String contrasenia);
    public Collection<Usuario> findAll();
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.idao;

import ec.edu.ups.modelo.Carrito;
import java.util.Collection;

/**
 *
 * @author dduta
 */
public interface IdaoCarrito {
    public void create(Carrito carrito);
    public Carrito read(int codigo);
    public void update(Carrito carrito);
    public void delete(Carrito carrito);
    public Collection<Carrito> findAll();
}

<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.dao;

import ec.edu.ups.modelo.Carrito;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import ec.edu.ups.idao.IdaoCarrito;

/**
 *
 * @author dduta
 */
public class DaoCarrito implements IdaoCarrito{
    
    private Map<Integer, Carrito> carritos;

    public DaoCarrito() {
        this.carritos= new HashMap<Integer,Carrito>();
    }

    @Override
    public void create(Carrito carrito) {
        carritos.put(carrito.getNumeroCarrito(), carrito);
    }

    @Override
    public Carrito read(int codigo) {
        return carritos.get(codigo);
    }

    @Override
    public void update(Carrito carrito) {
        carritos.put(carrito.getNumeroCarrito(), carrito);
    }

    @Override
    public void delete(Carrito carrito) {
        carritos.remove(carrito.getNumeroCarrito());
    }

    @Override
    public Collection<Carrito> findAll() {
        Collection<Carrito> carrito = carritos.values();
        return carrito;
    } 
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaUsuario;

import com.sun.imageio.plugins.jpeg.JPEG;
import ec.edu.ups.controlador.ControladorUsuario;
import ec.edu.ups.ventanPrincipal.Principal;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 *
 * @author dduta
 */
public class IngresarUsuario extends javax.swing.JInternalFrame {

    private Principal p;
    private Locale localizacion;
    private ResourceBundle mensajes;

    private ControladorUsuario controladorUsuario;

    public IngresarUsuario(ControladorUsuario controladorUsuario, Principal p) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladorUsuario = controladorUsuario;
        this.p = p;
        
    }

    public void limpiar() {
        txtContraseniaU.setText("");
        txtCorreoU.setText("");
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
      mensajes=ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        lebelCorreoU.setText(mensajes.getString("lebelCorreoU"));
        lebelContraseniaU.setText(mensajes.getString("lebelContraseniaU"));
        ButtonIngresarU.setText(mensajes.getString("ButtonIngresarU"));
        ButtonCancelarU.setText(mensajes.getString("ButtonCancelarU"));
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jTextField2 = new javax.swing.JTextField();
        ButtonCancelarU = new javax.swing.JButton();
        lebelCorreoU = new javax.swing.JLabel();
        lebelContraseniaU = new javax.swing.JLabel();
        txtCorreoU = new javax.swing.JTextField();
        txtContraseniaU = new javax.swing.JPasswordField();
        ButtonIngresarU = new javax.swing.JButton();

        jButton1.setText("Ingresar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTextField2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField2ActionPerformed(evt);
            }
        });

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Inicia Sesion");

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

        lebelCorreoU.setText("Correo:");

        lebelContraseniaU.setText("Contraseña");

        txtCorreoU.setToolTipText("Ingresa el Usuario o Correo");
        txtCorreoU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCorreoUActionPerformed(evt);
            }
        });

        txtContraseniaU.setToolTipText("Ingresa la contraseña");
        txtContraseniaU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtContraseniaUActionPerformed(evt);
            }
        });

        ButtonIngresarU.setText("Ingresar");
        ButtonIngresarU.setToolTipText("Dale push para Inicion Sesion");
        ButtonIngresarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonIngresarUActionPerformed(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()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(25, 25, 25)
                                .addComponent(lebelCorreoU)
                                .addGap(23, 23, 23))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(lebelContraseniaU)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtCorreoU, javax.swing.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE)
                            .addComponent(txtContraseniaU)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(ButtonIngresarU)
                        .addGap(18, 18, 18)
                        .addComponent(ButtonCancelarU)))
                .addContainerGap(53, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCorreoU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lebelCorreoU))
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lebelContraseniaU)
                    .addComponent(txtContraseniaU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonCancelarU)
                    .addComponent(ButtonIngresarU))
                .addContainerGap(30, Short.MAX_VALUE))
        );

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed


    }//GEN-LAST:event_jButton1ActionPerformed

    private void txtCorreoUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCorreoUActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtCorreoUActionPerformed

    private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField2ActionPerformed

    private void txtContraseniaUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtContraseniaUActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtContraseniaUActionPerformed

    private void ButtonIngresarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonIngresarUActionPerformed
        if (!txtContraseniaU.getText().isEmpty() && !txtCorreoU.getText().isEmpty()) {
            if (controladorUsuario.validar(String.valueOf(txtContraseniaU.getPassword()), txtCorreoU.getText()) != null) {

                JOptionPane.showMessageDialog(this, "A iniciado sesion correctamente");

                p.getMenuBuscar().setVisible(true);
                p.getMenuBuscarP().setVisible(true);
                p.getMenuCrearC().setVisible(true);
                p.getMenuCrearP().setVisible(true);
                p.getMenuEditarU().setVisible(true);
                p.getMenuEliminarC().setVisible(true);
                p.getMenuListar().setVisible(true);
                p.getMenueliminarU().setVisible(true);
                p.getMenuAcutualizarP().setVisible(true);
                p.getMenuEliminarP().setVisible(true);
                p.getCerrarS().setVisible(true);
                p.getCrearU().setVisible(false);
                p.getMenuIniciar().setVisible(false);
                limpiar();
                this.setVisible(false);
            } else {
                JOptionPane.showMessageDialog(null, "Contraseña o correo incorrectos");
                limpiar();
                this.setVisible(false);

            }
        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }
    }//GEN-LAST:event_ButtonIngresarUActionPerformed

    private void ButtonCancelarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCancelarUActionPerformed
        limpiar();
        this.setVisible(false);
    }//GEN-LAST:event_ButtonCancelarUActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonCancelarU;
    private javax.swing.JButton ButtonIngresarU;
    private javax.swing.JButton jButton1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JLabel lebelContraseniaU;
    private javax.swing.JLabel lebelCorreoU;
    private javax.swing.JPasswordField txtContraseniaU;
    private javax.swing.JTextField txtCorreoU;
    // End of variables declaration//GEN-END:variables
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaUsuario;

import ec.edu.ups.controlador.ControladorUsuario;
import ec.edu.ups.modelo.Usuario;
import java.util.Collection;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author dduta
 */
public class BuscarUsuario extends javax.swing.JInternalFrame {

    private ControladorUsuario controladoUsuario;
    private Locale localizacion;
    private ResourceBundle mensajes;
    private String cedula;
    private String nombre;
    private String apellido;
    private String correo;
    private String tipo;

    /**
     * Creates new form BuscarUsuario
     */
    public BuscarUsuario(ControladorUsuario controladoUsuario) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladoUsuario = controladoUsuario;
    }

    public void actalizar(Collection<Usuario> usuarios) {
        DefaultTableModel modelo = (DefaultTableModel) tableBuscarU.getModel();
        modelo.setRowCount(0);
        for (Usuario usuario : usuarios) {
            Object[] fila = new Object[4];
            fila[0] = usuario.getTipo();
            fila[1] = usuario.getNombre();
            fila[2] = usuario.getApellido();
            fila[3] = usuario.getCorreo();
        }
        tableBuscarU.setModel(modelo);
    }

    public void limpiar() {
        txtBuscarU.setText("");
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
        mensajes = ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        dd.setText(mensajes.getString("dd"));
        ButtonBuscarU.setText(mensajes.getString("ButtonBuscarU"));
        ca.setText(mensajes.getString("ca"));
        
        this.cedula = mensajes.getString("cedula");
        this.nombre = mensajes.getString("nombre");
        this.apellido = mensajes.getString("apellido");
        this.correo = mensajes.getString("correo");
        this.tipo = mensajes.getString("tipo");
        
        DefaultTableModel modelo = (DefaultTableModel) tableBuscarU.getModel();
        modelo.setColumnCount(0);
        modelo.setRowCount(0);
        modelo.addColumn(cedula);
        modelo.addColumn(tipo);
        modelo.addColumn(nombre);
        modelo.addColumn(apellido);
        modelo.addColumn(correo);
        this.tableBuscarU.setModel(modelo);

    }

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

        dd = new javax.swing.JLabel();
        txtBuscarU = new javax.swing.JTextField();
        ButtonBuscarU = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableBuscarU = new javax.swing.JTable();
        ca = new javax.swing.JButton();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Buscar Usuario");

        dd.setText("Ingrese el Codigo de la persona a Buscar:");

        txtBuscarU.setToolTipText("Inserta el codigo para listar el Usuario");
        txtBuscarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtBuscarUActionPerformed(evt);
            }
        });

        ButtonBuscarU.setText("Buscar");
        ButtonBuscarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBuscarUActionPerformed(evt);
            }
        });

        tableBuscarU.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Cedula", "Tipo", "Nombre", "Apellido", "Correo"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tableBuscarU);

        ca.setText("Cancelar");
        ca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                caActionPerformed(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()
                        .addGap(19, 19, 19)
                        .addComponent(dd)
                        .addGap(18, 18, 18)
                        .addComponent(txtBuscarU, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(43, 43, 43)
                        .addComponent(ButtonBuscarU))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(34, 34, 34)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 570, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(253, 253, 253)
                        .addComponent(ca)))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtBuscarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dd)
                    .addComponent(ButtonBuscarU))
                .addGap(37, 37, 37)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(ca)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

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

    private void txtBuscarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtBuscarUActionPerformed

    }//GEN-LAST:event_txtBuscarUActionPerformed

    private void ButtonBuscarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBuscarUActionPerformed
        if (!txtBuscarU.getText().isEmpty()) {
            if (controladoUsuario.read(txtBuscarU.getText()) != null) {
                DefaultTableModel modelo = (DefaultTableModel) tableBuscarU.getModel();
                modelo.setRowCount(0);
                Object[] rowData = {controladoUsuario.read(txtBuscarU.getText()).getId(), controladoUsuario.read(txtBuscarU.getText()).getTipo(),
                    controladoUsuario.read(txtBuscarU.getText()).getNombre(), controladoUsuario.read(txtBuscarU.getText()).getApellido(), controladoUsuario.read(txtBuscarU.getText()).getCorreo()};
                modelo.addRow(rowData);
                limpiar();
            } else {
                JOptionPane.showMessageDialog(null, "el Usuario no existe");
                limpiar();
            }
        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }
    }//GEN-LAST:event_ButtonBuscarUActionPerformed

    private void caActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_caActionPerformed
        this.setVisible(false);
    }//GEN-LAST:event_caActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonBuscarU;
    private javax.swing.JButton ca;
    private javax.swing.JLabel dd;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tableBuscarU;
    private javax.swing.JTextField txtBuscarU;
    // End of variables declaration//GEN-END:variables
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.controlador;

import ec.edu.ups.modelo.Producto;
import java.util.Collection;
import ec.edu.ups.idao.IdaoProducto;

/**
 *
 * @author dduta
 */
public class ControladorProducto {
    private IdaoProducto idaoP;
    private Producto producto;

    public ControladorProducto(IdaoProducto IDAOProducto) {
        idaoP=IDAOProducto;
    }
    
    public void create(int codigo,String descripcion,double precio){
        producto= new Producto(codigo, descripcion, precio);
        idaoP.create(producto);
    }
    
    public Producto read(int codigo){
         producto=idaoP.read(codigo);
        if(producto!=null){
            return producto;
        }else{
            System.out.println("El producto no existente");
        }
        return null;
    } 
    
    public void update(int codigo,String descripcion,double precio){
        producto= new Producto(codigo, descripcion, precio);
        idaoP.update(producto);
    }
    
    public void delete(int codigo){
      producto=new Producto(codigo, null, 0);
      idaoP.delete(producto);
    }
    
     public Collection<Producto> findAll() {
        return idaoP.findAll();
    }
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaProducto;

import ec.edu.ups.controlador.ControladorProducto;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 *
 * @author dduta
 */
public class ModificarProducto extends javax.swing.JInternalFrame {

    private ControladorProducto controladorProducto;
    private Locale localizacion;
    private ResourceBundle mensajes;

    /**
     * Creates new form VentanaModificar
     */
    public ModificarProducto(ControladorProducto controladorProducto) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladorProducto = controladorProducto;
    }

    public void limpiar() {
        txtCodigoP.setText("");
        txtDescrpcionActualizarP.setText("");
        txtPrecioActualizarP.setText("");
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
        mensajes = ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        ingreseproducto.setText(mensajes.getString("ingreseproducto"));
        ButtonBuscarP.setText(mensajes.getString("ButtonBuscarP"));
        ingreselosdatos.setText(mensajes.getString("ingreselosdatos"));
        jj.setText(mensajes.getString("jj"));
        PrecioP.setText(mensajes.getString("PrecioP"));
        ButtonActualizarP.setText(mensajes.getString("ButtonActualizarP"));
        ButtonCancelarA.setText(mensajes.getString("ButtonCancelarA"));
    }

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

        ingreseproducto = new javax.swing.JLabel();
        ButtonBuscarP = new javax.swing.JButton();
        txtCodigoP = new javax.swing.JTextField();
        ingreselosdatos = new javax.swing.JLabel();
        ButtonActualizarP = new javax.swing.JButton();
        jj = new javax.swing.JLabel();
        txtDescrpcionActualizarP = new javax.swing.JTextField();
        PrecioP = new javax.swing.JLabel();
        txtPrecioActualizarP = new javax.swing.JTextField();
        ButtonCancelarA = new javax.swing.JButton();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Modificar Producto");

        ingreseproducto.setText("Ingrese el codigo del producto a Modificar:");

        ButtonBuscarP.setText("Buscar");
        ButtonBuscarP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBuscarPActionPerformed(evt);
            }
        });

        ingreselosdatos.setText("Ingrese los nuevos datos del Producto");

        ButtonActualizarP.setText("Actualizar");
        ButtonActualizarP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonActualizarPActionPerformed(evt);
            }
        });

        jj.setText("Descripcion:");

        txtDescrpcionActualizarP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDescrpcionActualizarPActionPerformed(evt);
            }
        });

        PrecioP.setText("Precio:");

        ButtonCancelarA.setText("Cancelar");
        ButtonCancelarA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonCancelarAActionPerformed(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()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(97, 97, 97)
                                .addComponent(jj))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(PrecioP)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtDescrpcionActualizarP, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addComponent(txtPrecioActualizarP, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(ingreselosdatos)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(ingreseproducto)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(txtCodigoP, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(63, 63, 63)
                                .addComponent(ButtonActualizarP)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(ButtonCancelarA)))
                        .addGap(18, 18, 18)
                        .addComponent(ButtonBuscarP)))
                .addContainerGap(24, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonBuscarP)
                    .addComponent(ingreseproducto)
                    .addComponent(txtCodigoP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(ingreselosdatos)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jj)
                    .addComponent(txtDescrpcionActualizarP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(PrecioP)
                    .addComponent(txtPrecioActualizarP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonActualizarP)
                    .addComponent(ButtonCancelarA))
                .addContainerGap(36, Short.MAX_VALUE))
        );

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

    private void txtDescrpcionActualizarPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDescrpcionActualizarPActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtDescrpcionActualizarPActionPerformed

    private void ButtonBuscarPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBuscarPActionPerformed
        if (!txtCodigoP.getText().isEmpty()) {
            if (controladorProducto.read(Integer.valueOf(txtCodigoP.getText())) != null) {
                txtDescrpcionActualizarP.setText(controladorProducto.read(Integer.valueOf(txtCodigoP.getText())).getDescripcion());
                double total = controladorProducto.read(Integer.parseInt(txtCodigoP.getText())).getPrecio();
                txtPrecioActualizarP.setText(String.valueOf(total));

            } else {
                JOptionPane.showMessageDialog(null, "No existe el Usuario");
                limpiar();
            }
        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }
    }//GEN-LAST:event_ButtonBuscarPActionPerformed

    private void ButtonActualizarPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonActualizarPActionPerformed
        if (!txtDescrpcionActualizarP.getText().isEmpty() && !txtPrecioActualizarP.getText().isEmpty()) {
            controladorProducto.update(Integer.parseInt(txtCodigoP.getText()), txtDescrpcionActualizarP.getText(), Double.valueOf(txtPrecioActualizarP.getText()));
            JOptionPane.showMessageDialog(null, "Producto Actualizado");
            limpiar();
            this.setVisible(false);
        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }
    }//GEN-LAST:event_ButtonActualizarPActionPerformed

    private void ButtonCancelarAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonCancelarAActionPerformed
        limpiar();
        this.setVisible(false);
    }//GEN-LAST:event_ButtonCancelarAActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonActualizarP;
    private javax.swing.JButton ButtonBuscarP;
    private javax.swing.JButton ButtonCancelarA;
    private javax.swing.JLabel PrecioP;
    private javax.swing.JLabel ingreselosdatos;
    private javax.swing.JLabel ingreseproducto;
    private javax.swing.JLabel jj;
    private javax.swing.JTextField txtCodigoP;
    private javax.swing.JTextField txtDescrpcionActualizarP;
    private javax.swing.JTextField txtPrecioActualizarP;
    // End of variables declaration//GEN-END:variables
}
<file_sep>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ec.edu.ups.ventanaUsuario;

import ec.edu.ups.controlador.ControladorUsuario;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

/**
 *
 * @author dduta
 */
public class EliminarUsuario extends javax.swing.JInternalFrame {

    private ControladorUsuario controladoUsuario;
    private Locale localizacion;
    private ResourceBundle mensajes;

    /**
     * Creates new form EliminarUsuario
     */
    public EliminarUsuario(ControladorUsuario controladoUsuario) {
        initComponents();
        this.mensajes = mensajes;
        cambiarIdioma(mensajes);
        this.controladoUsuario = controladoUsuario;
    }

    public void limpiar() {
        txtEliminarU.setText("");
    }

    public void cambiarIdioma(ResourceBundle mensajes) {
        mensajes = ResourceBundle.getBundle("ec.edu.ups.Idiomas.mensajes", Locale.getDefault());
        lebelEliminarU.setText(mensajes.getString("lebelEliminarU"));
        ButtonEliminarU.setText(mensajes.getString("ButtonEliminarU"));
        labelCancelarU.setText(mensajes.getString("labelCancelarU"));
    }

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

        lebelEliminarU = new javax.swing.JLabel();
        txtEliminarU = new javax.swing.JTextField();
        ButtonEliminarU = new javax.swing.JButton();
        labelCancelarU = new javax.swing.JButton();

        setClosable(true);
        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setTitle("Eliminar un Usuario");

        lebelEliminarU.setText("Ingrese la Cedula del Usuario a Eliminar:");

        txtEliminarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEliminarUActionPerformed(evt);
            }
        });

        ButtonEliminarU.setText("Eliminar");
        ButtonEliminarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonEliminarUActionPerformed(evt);
            }
        });

        labelCancelarU.setText("Cancelar");
        labelCancelarU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                labelCancelarUActionPerformed(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(27, 27, 27)
                .addComponent(lebelEliminarU)
                .addGap(26, 26, 26)
                .addComponent(txtEliminarU, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(100, 100, 100)
                .addComponent(ButtonEliminarU)
                .addGap(18, 18, 18)
                .addComponent(labelCancelarU)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEliminarU, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lebelEliminarU))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ButtonEliminarU)
                    .addComponent(labelCancelarU))
                .addContainerGap(39, Short.MAX_VALUE))
        );

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

    private void txtEliminarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEliminarUActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEliminarUActionPerformed

    private void ButtonEliminarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonEliminarUActionPerformed
        if (!txtEliminarU.getText().isEmpty()) {
            if (controladoUsuario.read(txtEliminarU.getText()) != null) {
                controladoUsuario.delete(txtEliminarU.getText());
                JOptionPane.showMessageDialog(null, "Eliminado Con Exito");
                limpiar();
            } else {
                JOptionPane.showMessageDialog(null, "usuario no existe");
                limpiar();
                this.setVisible(false);
            }

        } else {
            JOptionPane.showMessageDialog(null, "Llena todos los Campos");
        }


    }//GEN-LAST:event_ButtonEliminarUActionPerformed

    private void labelCancelarUActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_labelCancelarUActionPerformed

        this.setVisible(false);
    }//GEN-LAST:event_labelCancelarUActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonEliminarU;
    private javax.swing.JButton labelCancelarU;
    private javax.swing.JLabel lebelEliminarU;
    private javax.swing.JTextField txtEliminarU;
    // End of variables declaration//GEN-END:variables
}
