Presentacion.FUsuarios.java Source code

Java tutorial

Introduction

Here is the source code for Presentacion.FUsuarios.java

Source

/*
 * 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 Presentacion;

import webservice.Categoria;
import webservice.Cliente;
import org.apache.commons.codec.digest.DigestUtils;
import java.awt.HeadlessException;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.time.Clock;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import webservice.ControllerInterface;
import webservice.QuickOrderWebService;

/**
 *
 * @author heb
 */
public class FUsuarios extends javax.swing.JFrame {

    JFileChooser fc;
    String userImgName;

    List<String> categoriasSeleccionadas;

    DefaultListModel<String> listModelCategorias = new DefaultListModel<>();
    DefaultListModel<String> listModelCategoriasSeleccionadas = new DefaultListModel<>();

    List<String> urlsImages;

    public FUsuarios() {

        initComponents();
        urlsImages = new ArrayList<>();

        QuickOrderWebService webService = new QuickOrderWebService();
        ControllerInterface port = webService.getQuickOrderWebServicePort();

        port.listaCategorias().getItem().stream().forEach((cat) -> {
            listModelCategorias.addElement(cat.getNombre());
        });

        lstCategorias.setModel(listModelCategorias);
        categoriasSeleccionadas = new ArrayList<>();

        ICategoriasDisponibles.setVisible(false);
        IRegistrarRestaurante.setVisible(false);
        IRegistrarCliente.setVisible(true);
        IRegistrarCliente.pack();
    }

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

        IRegistrarRestaurante = new javax.swing.JInternalFrame();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtRestNickname = new javax.swing.JTextField();
        txtRestCorreo = new javax.swing.JTextField();
        txtRestNombre = new javax.swing.JTextField();
        txtRestDir = new javax.swing.JTextField();
        btnAddImagenes = new javax.swing.JButton();
        brnRestCancelar = new javax.swing.JButton();
        btnRestRegistrar = new javax.swing.JButton();
        btnSelectCategorias = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jPasswordField1 = new javax.swing.JPasswordField();
        IRegistrarCliente = new javax.swing.JInternalFrame();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        txtNickName = new javax.swing.JTextField();
        txtEmail = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        txtApellido = new javax.swing.JTextField();
        txtDireccion = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        drpDay = new javax.swing.JSpinner();
        drpMes = new javax.swing.JSpinner();
        drpYear = new javax.swing.JSpinner();
        btnCancelar = new javax.swing.JButton();
        btnRegistrarCliente = new javax.swing.JButton();
        btnImagen = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jPasswordField2 = new javax.swing.JPasswordField();
        ICategoriasDisponibles = new javax.swing.JInternalFrame();
        jScrollPane1 = new javax.swing.JScrollPane();
        lstCategoriasSeleccionadas = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        lstCategorias = new javax.swing.JList();
        jLabel5 = new javax.swing.JLabel();
        btnCategoriaOk = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        btnCategoriaAdd = new javax.swing.JButton();
        btnCatRemover = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuRegistrarcliente = new javax.swing.JMenu();
        menuRegistrarRestaurante = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        IRegistrarRestaurante.setTitle("Registrar Restaurante");
        IRegistrarRestaurante.setToolTipText("");
        IRegistrarRestaurante.setVisible(true);

        jLabel1.setText("Ingrese los siguientes datos:");

        jLabel2.setText("Nickname:");

        jLabel3.setText("Correo electrnico:");

        jLabel4.setText("Nombre:");

        jLabel6.setText("Direccin:");

        btnAddImagenes.setText("Seleccionar Imgenes");
        btnAddImagenes.setToolTipText("");
        btnAddImagenes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnAddImagenesMouseClicked(evt);
            }
        });
        btnAddImagenes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddImagenesActionPerformed(evt);
            }
        });

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

        btnRestRegistrar.setText("Registrar");
        btnRestRegistrar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnRestRegistrarMouseClicked(evt);
            }
        });
        btnRestRegistrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRestRegistrarActionPerformed(evt);
            }
        });

        btnSelectCategorias.setText("Seleccionar Categorias");
        btnSelectCategorias.setToolTipText("");
        btnSelectCategorias.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnSelectCategoriasMouseClicked(evt);
            }
        });

        jLabel16.setText("Imagenes:");

        jLabel17.setText("Categorias:");

        jLabel19.setText("Contrasea:");

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

        javax.swing.GroupLayout IRegistrarRestauranteLayout = new javax.swing.GroupLayout(
                IRegistrarRestaurante.getContentPane());
        IRegistrarRestaurante.getContentPane().setLayout(IRegistrarRestauranteLayout);
        IRegistrarRestauranteLayout.setHorizontalGroup(IRegistrarRestauranteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup().addGap(25, 25, 25)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup().addComponent(jLabel1)
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup()
                                        .addGroup(IRegistrarRestauranteLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup()
                                                        .addComponent(jLabel2)
                                                        .addPreferredGap(
                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                Short.MAX_VALUE)
                                                        .addComponent(txtRestNickname,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 196,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                        IRegistrarRestauranteLayout.createSequentialGroup()
                                                                .addGap(0, 0, Short.MAX_VALUE)
                                                                .addGroup(IRegistrarRestauranteLayout
                                                                        .createParallelGroup(
                                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                                        .addGroup(
                                                                                javax.swing.GroupLayout.Alignment.TRAILING,
                                                                                IRegistrarRestauranteLayout
                                                                                        .createSequentialGroup()
                                                                                        .addGroup(
                                                                                                IRegistrarRestauranteLayout
                                                                                                        .createParallelGroup(
                                                                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                                                                        .addComponent(
                                                                                                                jLabel3)
                                                                                                        .addComponent(
                                                                                                                jLabel4)
                                                                                                        .addComponent(
                                                                                                                jLabel6)
                                                                                                        .addComponent(
                                                                                                                jLabel17)
                                                                                                        .addComponent(
                                                                                                                jLabel16)
                                                                                                        .addComponent(
                                                                                                                jLabel19))
                                                                                        .addGap(22, 22, 22)
                                                                                        .addGroup(
                                                                                                IRegistrarRestauranteLayout
                                                                                                        .createParallelGroup(
                                                                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                                                                        .addComponent(
                                                                                                                jPasswordField1,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                                        .addComponent(
                                                                                                                txtRestCorreo,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                                        .addComponent(
                                                                                                                txtRestNombre,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                                        .addComponent(
                                                                                                                txtRestDir,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                                        .addComponent(
                                                                                                                btnSelectCategorias,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                                                        .addComponent(
                                                                                                                btnAddImagenes,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                196,
                                                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                                        .addGroup(
                                                                                javax.swing.GroupLayout.Alignment.TRAILING,
                                                                                IRegistrarRestauranteLayout
                                                                                        .createSequentialGroup()
                                                                                        .addComponent(
                                                                                                brnRestCancelar)
                                                                                        .addPreferredGap(
                                                                                                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                                        .addComponent(
                                                                                                btnRestRegistrar)))))
                                        .addGap(30, 30, 30)))));
        IRegistrarRestauranteLayout.setVerticalGroup(IRegistrarRestauranteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup().addGap(10, 10, 10)
                        .addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(IRegistrarRestauranteLayout.createSequentialGroup()
                                        .addGroup(IRegistrarRestauranteLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel2).addComponent(txtRestNickname,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jLabel19))
                                .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3).addComponent(txtRestCorreo,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel4).addComponent(txtRestNombre,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel6).addComponent(txtRestDir,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnSelectCategorias).addComponent(jLabel17))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnAddImagenes).addComponent(jLabel16))
                        .addGap(18, 18, 18)
                        .addGroup(IRegistrarRestauranteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnRestRegistrar).addComponent(brnRestCancelar))
                        .addContainerGap(19, Short.MAX_VALUE)));

        IRegistrarCliente.setTitle("Registrar Cliente");
        IRegistrarCliente.setToolTipText("");
        IRegistrarCliente.setVisible(true);

        jLabel8.setText("Ingrese los siguientes datos:");

        jLabel9.setText("Nickname:");

        jLabel10.setText("Correo electrnico:");

        jLabel11.setText("Nombre:");

        jLabel12.setText("Apellido:");

        jLabel13.setText("Direccin:");

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

        jLabel14.setText("Fecha de Nacimiento");

        btnCancelar.setText("Cancelar");
        btnCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCancelarMouseClicked(evt);
            }
        });

        btnRegistrarCliente.setText("Registrar");
        btnRegistrarCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnRegistrarClienteMouseClicked(evt);
            }
        });

        btnImagen.setText("Seleccionar Imgenes");
        btnImagen.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnImagenMouseClicked(evt);
            }
        });

        jLabel15.setText("Imgen: ");

        jLabel18.setText("Contrasea:");

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

        javax.swing.GroupLayout IRegistrarClienteLayout = new javax.swing.GroupLayout(
                IRegistrarCliente.getContentPane());
        IRegistrarCliente.getContentPane().setLayout(IRegistrarClienteLayout);
        IRegistrarClienteLayout.setHorizontalGroup(IRegistrarClienteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(IRegistrarClienteLayout.createSequentialGroup().addGap(25, 25, 25)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel8)
                                .addGroup(IRegistrarClienteLayout.createSequentialGroup()
                                        .addGroup(IRegistrarClienteLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel9).addComponent(jLabel10).addComponent(jLabel11)
                                                .addComponent(jLabel12).addComponent(jLabel13)
                                                .addComponent(jLabel14).addComponent(jLabel15)
                                                .addComponent(jLabel18))
                                        .addGap(31, 31, 31)
                                        .addGroup(IRegistrarClienteLayout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jPasswordField2,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGroup(IRegistrarClienteLayout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(txtNickName,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtEmail,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtNombre,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtApellido,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(txtDireccion,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(btnImagen,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 197,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                                IRegistrarClienteLayout.createSequentialGroup()
                                                                        .addComponent(btnCancelar,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                77,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addPreferredGap(
                                                                                javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                        .addComponent(btnRegistrarCliente))
                                                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                                IRegistrarClienteLayout.createSequentialGroup()
                                                                        .addComponent(drpDay,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                62,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addPreferredGap(
                                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                        .addComponent(drpMes,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                57,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                        .addPreferredGap(
                                                                                javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                        .addComponent(drpYear,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                66,
                                                                                javax.swing.GroupLayout.PREFERRED_SIZE))))))
                        .addGap(0, 0, Short.MAX_VALUE)));
        IRegistrarClienteLayout.setVerticalGroup(IRegistrarClienteLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(IRegistrarClienteLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel9)
                                .addComponent(txtNickName, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel10).addComponent(txtEmail,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel11).addComponent(txtNombre,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel12).addComponent(txtApellido,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel13).addComponent(txtDireccion,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(7, 7, 7)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel18).addComponent(jPasswordField2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel14)
                                .addComponent(drpDay, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(drpMes, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(drpYear, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnImagen).addComponent(jLabel15))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(IRegistrarClienteLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btnRegistrarCliente).addComponent(btnCancelar))
                        .addContainerGap(79, Short.MAX_VALUE)));

        ICategoriasDisponibles.setTitle("Seleccionar Categoras");
        ICategoriasDisponibles.setToolTipText("");
        ICategoriasDisponibles.setVisible(true);

        jScrollPane1.setViewportView(lstCategoriasSeleccionadas);

        jScrollPane2.setViewportView(lstCategorias);

        jLabel5.setFont(new java.awt.Font("Dialog", 0, 11)); // NOI18N
        jLabel5.setText("Categoras disponibles");

        btnCategoriaOk.setText("Finalizar");
        btnCategoriaOk.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCategoriaOkActionPerformed(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Dialog", 0, 11)); // NOI18N
        jLabel7.setText("Categoras seleccionadas");

        btnCategoriaAdd.setText(">>");
        btnCategoriaAdd.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCategoriaAddMouseClicked(evt);
            }
        });

        btnCatRemover.setText("<<");
        btnCatRemover.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnCatRemoverMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout ICategoriasDisponiblesLayout = new javax.swing.GroupLayout(
                ICategoriasDisponibles.getContentPane());
        ICategoriasDisponibles.getContentPane().setLayout(ICategoriasDisponiblesLayout);
        ICategoriasDisponiblesLayout.setHorizontalGroup(ICategoriasDisponiblesLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup().addContainerGap()
                        .addGroup(ICategoriasDisponiblesLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(btnCategoriaOk)
                                .addGroup(ICategoriasDisponiblesLayout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel5)
                                        .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup()
                                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                        169, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(
                                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(ICategoriasDisponiblesLayout
                                                        .createParallelGroup(
                                                                javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(btnCatRemover,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 54,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(btnCategoriaAdd,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE, 54,
                                                                javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(ICategoriasDisponiblesLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 171,
                                        Short.MAX_VALUE)
                                .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup().addComponent(jLabel7)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        ICategoriasDisponiblesLayout.setVerticalGroup(ICategoriasDisponiblesLayout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ICategoriasDisponiblesLayout
                        .createSequentialGroup().addContainerGap()
                        .addGroup(ICategoriasDisponiblesLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(ICategoriasDisponiblesLayout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup().addGap(49, 49, 49)
                                        .addComponent(btnCategoriaAdd)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(btnCatRemover))
                                .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 183,
                                                Short.MAX_VALUE))
                                .addGroup(ICategoriasDisponiblesLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jScrollPane1)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 100, Short.MAX_VALUE)
                        .addComponent(btnCategoriaOk).addContainerGap()));

        menuRegistrarcliente.setText("Registrar Cliente");
        menuRegistrarcliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menuRegistrarclienteMouseClicked(evt);
            }
        });
        jMenuBar1.add(menuRegistrarcliente);

        menuRegistrarRestaurante.setText("RegistrarRestaurante");
        menuRegistrarRestaurante.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menuRegistrarRestauranteMouseClicked(evt);
            }
        });
        jMenuBar1.add(menuRegistrarRestaurante);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(IRegistrarCliente).addComponent(IRegistrarRestaurante))
                        .addGap(18, 18, 18).addComponent(ICategoriasDisponibles).addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                layout.createSequentialGroup().addContainerGap().addGroup(layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(ICategoriasDisponibles, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(IRegistrarRestaurante, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(IRegistrarCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

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

    /*ALTA USUARIO DEL TIPO CLIENTE */

    private void btnImagenMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnImagenMouseClicked

        try {
            fc = new JFileChooser();
            fc.setAcceptAllFileFilterUsed(false); // No deja seleccionar todo tipo de archivos
            FileNameExtensionFilter filtroImagen = new FileNameExtensionFilter("Imgenes JPG, PNG & GIF", "jpg",
                    "png", "gif");//Creo filtro para tipo de imagen
            fc.addChoosableFileFilter(filtroImagen);// Asigno el filtro creado de imagenes

            int returnVal = fc.showOpenDialog(this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {

                String path = this.getClass().getResource("Imagenes").getPath();

                File file = fc.getSelectedFile();

                String extension = file.getName().substring((file.getName().lastIndexOf(".") + 1));
                userImgName = path + "\\" + txtNickName.getText() + ".jpg";
                File fileToSave = new File(userImgName);
                FileWriter fileWr = new FileWriter(fileToSave);
                fileWr.close();
                Files.copy(fc.getSelectedFile().toPath(), fileToSave.toPath(), StandardCopyOption.REPLACE_EXISTING);
            }
        } catch (HeadlessException | IOException ex) {
            JOptionPane.showMessageDialog(this, "Error al cargar imagen", "Error", JOptionPane.ERROR_MESSAGE);
            System.out.println("Error en alta cliente: " + ex.getMessage());
        }
    }//GEN-LAST:event_btnImagenMouseClicked

    private void btnRegistrarClienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnRegistrarClienteMouseClicked
        if (fc == null || !fc.getSelectedFile().isFile()) {
            JOptionPane.showMessageDialog(this, "Debe seleccionar una imagen", "Alerta",
                    JOptionPane.WARNING_MESSAGE);
        } else {

            if (txtApellido.getText().isEmpty() || txtDireccion.getText().isEmpty() || txtEmail.getText().isEmpty()
                    || txtNickName.getText().isEmpty() || txtNombre.getText().isEmpty()) {
                JOptionPane.showMessageDialog(this, "Debe ingresar todos los datos", "Alerta",
                        JOptionPane.WARNING_MESSAGE);
            } else {
                webservice.Cliente user = new Cliente();
                user.setDireccion(txtDireccion.getText());
                user.setEmail(txtEmail.getText());
                user.setNickname(txtNickName.getText());
                user.setNombre(txtNombre.getText());
                user.setApellido(txtApellido.getText());

                //PORCEDIMIENTO PARA ENCRIPTAR LA CLAVE INGRESADA CUANDO INICIA SESIN UN USUARIO.
                String pass = jPasswordField2.getText();
                String encriptMD5 = DigestUtils.md5Hex(pass);
                pass = "md5:" + encriptMD5;

                user.setPassword(pass);

                try {
                    int year = Integer.getInteger(drpYear.getToolTipText());
                    int day = Integer.getInteger(drpDay.getModel().getValue().toString());
                    int month = Integer.getInteger(drpMes.getValue().toString());

                    GregorianCalendar c = new GregorianCalendar();
                    c.setTime(new Date(year, month, day));
                    XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);

                    user.setFechaNac(date2);
                } catch (Exception ex) {
                    GregorianCalendar c = new GregorianCalendar();
                    c.setTime(Date.from(Instant.EPOCH));

                    try {
                        XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
                        user.setFechaNac(date2);
                    } catch (Exception ex2) {
                        System.out.println("Error en fecha");
                    }
                }

                user.setImagen(txtNickName.getText() + ".jpg");

                QuickOrderWebService webService = new QuickOrderWebService();
                ControllerInterface port = webService.getQuickOrderWebServicePort();

                String result = port.registrarCliente(user);
                if (result.isEmpty()) {

                    JOptionPane.showMessageDialog(this, "Usuario ingresado correctamente");
                    txtApellido.setText("");
                    txtDireccion.setText("");
                    txtEmail.setText("");
                    txtNickName.setText("");
                    txtNombre.setText("");
                    jPasswordField2.setText("");
                } else {
                    if (result.equals("emailError1")) {
                        JOptionPane.showMessageDialog(this,
                                "El email ya se encuentra registrado, por favor ingrese otro.", "Alerta",
                                JOptionPane.WARNING_MESSAGE);
                    }
                    if (result.equals("nicknameError1")) {
                        JOptionPane.showMessageDialog(this,
                                "El nickname no se encuentra disponible, por favor ingrese otro.", "Alerta",
                                JOptionPane.WARNING_MESSAGE);
                    } else {
                        JOptionPane.showMessageDialog(this, "Error al ingresar el cliente", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                }

            }
        }
    }//GEN-LAST:event_btnRegistrarClienteMouseClicked

    private void btnCancelarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCancelarMouseClicked
        txtApellido.setText(null);
        txtDireccion.setText(null);
        txtEmail.setText(null);
        txtNickName.setText(null);
        txtNombre.setText(null);

        this.dispose();
    }//GEN-LAST:event_btnCancelarMouseClicked

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

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

        webservice.Restaurante rest = new webservice.Restaurante();
        rest.setDireccion(txtRestDir.getText());
        rest.setEmail(txtRestCorreo.getText());
        rest.setNickname(txtRestNickname.getText());
        rest.setNombre(txtRestNombre.getText());
        //PORCEDIMIENTO PARA ENCRIPTAR LA CLAVE INGRESADA CUANDO INICIA SESIN UN USUARIO.
        String pass = jPasswordField1.getText();
        String encriptMD5 = DigestUtils.md5Hex(pass);
        pass = "md5:" + encriptMD5;

        rest.setPassword(pass);

        for (String categoriasSeleccionada : categoriasSeleccionadas) {
            webservice.Categoria cat = new Categoria();
            cat.setNombre(categoriasSeleccionada);
            rest.getListaCategorias().add(cat);
        }
    }//GEN-LAST:event_btnRestRegistrarActionPerformed

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

        for (int i = 0; i < listModelCategoriasSeleccionadas.getSize(); i++) {
            String catName = listModelCategoriasSeleccionadas.getElementAt(i);
            categoriasSeleccionadas.add(catName);
        }

        ICategoriasDisponibles.setVisible(false);

    }//GEN-LAST:event_btnCategoriaOkActionPerformed

    private void btnCategoriaAddMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCategoriaAddMouseClicked

        String catName = listModelCategorias.getElementAt(lstCategorias.getSelectedIndex());

        if (!listModelCategoriasSeleccionadas.contains(catName)) {
            listModelCategoriasSeleccionadas.addElement(catName);
            listModelCategorias.removeElement(catName);
        }

        lstCategoriasSeleccionadas.setModel(listModelCategoriasSeleccionadas);
        lstCategorias.setModel(listModelCategorias);
    }//GEN-LAST:event_btnCategoriaAddMouseClicked

    private void btnCatRemoverMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnCatRemoverMouseClicked

        String catName = listModelCategoriasSeleccionadas
                .getElementAt(lstCategoriasSeleccionadas.getSelectedIndex());

        if (listModelCategoriasSeleccionadas.contains(catName)) {
            listModelCategoriasSeleccionadas.removeElement(catName);
            listModelCategorias.addElement(catName);
        }

        lstCategoriasSeleccionadas.setModel(listModelCategoriasSeleccionadas);
        lstCategorias.setModel(listModelCategorias);
    }//GEN-LAST:event_btnCatRemoverMouseClicked

    private void btnSelectCategoriasMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSelectCategoriasMouseClicked
        ICategoriasDisponibles.setVisible(true);
        ICategoriasDisponibles.pack();
        this.pack();
    }//GEN-LAST:event_btnSelectCategoriasMouseClicked

    private void menuRegistrarRestauranteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuRegistrarRestauranteMouseClicked
        ICategoriasDisponibles.setVisible(false);
        IRegistrarCliente.setVisible(false);
        IRegistrarRestaurante.setVisible(true);
        IRegistrarRestaurante.pack();
        this.pack();

    }//GEN-LAST:event_menuRegistrarRestauranteMouseClicked

    private void menuRegistrarclienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuRegistrarclienteMouseClicked
        ICategoriasDisponibles.setVisible(false);
        IRegistrarRestaurante.setVisible(false);
        IRegistrarCliente.setVisible(true);
        IRegistrarCliente.pack();
        this.pack();
    }//GEN-LAST:event_menuRegistrarclienteMouseClicked

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

    private void btnRestRegistrarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnRestRegistrarMouseClicked
        QuickOrderWebService webService = new QuickOrderWebService();
        ControllerInterface port = webService.getQuickOrderWebServicePort();

        if (port.validateEmail(txtRestCorreo.getText())) {
            if (txtRestDir.getText().isEmpty() || txtRestNickname.getText().isEmpty()
                    || txtRestCorreo.getText().isEmpty() || txtRestNombre.getText().isEmpty()) {
                JOptionPane.showMessageDialog(this, "Debe ingresar todos los datos", "Alerta",
                        JOptionPane.WARNING_MESSAGE);
            } else {
                try {
                    webservice.Restaurante res = new webservice.Restaurante();
                    res.setDireccion(txtRestDir.getText());
                    res.setPassword(jPasswordField2.getText());
                    res.setEmail(txtRestCorreo.getText());
                    res.setNickname(txtRestNickname.getText());
                    res.setNombre(txtRestNombre.getText());

                    //PORCEDIMIENTO PARA ENCRIPTAR LA CLAVE INGRESADA CUANDO INICIA SESIN UN USUARIO.
                    String pass = jPasswordField2.getText();
                    String encriptMD5 = DigestUtils.md5Hex(pass);
                    pass = "md5:" + encriptMD5;

                    res.setPassword(pass);

                    for (String categoriasSeleccionada : categoriasSeleccionadas) {
                        webservice.Categoria cat = new webservice.Categoria();
                        cat.setNombre(categoriasSeleccionada);
                        res.getListaCategorias().add(cat);
                    }
                    for (String str : urlsImages) {
                        res.getListaImagenes().add(str);
                    }

                    port.registrarRestaurante(res);
                    JOptionPane.showMessageDialog(this, "Alta efectuada con exito", "Alta Restaurante",
                            JOptionPane.INFORMATION_MESSAGE);

                    txtRestDir.setText("");
                    txtRestCorreo.setText("");
                    txtRestNickname.setText("");
                    txtRestNombre.setText("");
                    jPasswordField2.setText("");

                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(this, "Error en alta de Restaurante", "Alta Restaurante",
                            JOptionPane.WARNING_MESSAGE);
                    System.out.println(ex.getMessage());
                }
            }
        } else {
            JOptionPane.showMessageDialog(this, "Debe ingresar un formato de correo valido", "Alerta",
                    JOptionPane.WARNING_MESSAGE);
        }
    }//GEN-LAST:event_btnRestRegistrarMouseClicked

    private void btnAddImagenesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnAddImagenesMouseClicked

        try {
            fc = new JFileChooser();
            fc.setAcceptAllFileFilterUsed(false); // No deja seleccionar todo tipo de archivos
            FileNameExtensionFilter filtroImagen = new FileNameExtensionFilter("Imgenes JPG, PNG & GIF", "jpg",
                    "png", "gif");//Creo filtro para tipo de imagen
            fc.addChoosableFileFilter(filtroImagen);// Asigno el filtro creado de imagenes

            int returnVal = fc.showOpenDialog(this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {

                String path = this.getClass().getResource("Imagenes").getPath();

                File file = fc.getSelectedFile();
                userImgName = path + "\\" + txtRestNickname.getText() + "-" + urlsImages.size() + ".jpg";
                File fileToSave = new File(userImgName);
                FileWriter fileWr = new FileWriter(fileToSave);
                fileWr.close();
                Files.copy(fc.getSelectedFile().toPath(), fileToSave.toPath(), StandardCopyOption.REPLACE_EXISTING);
                urlsImages.add(txtRestNickname.getText() + "-" + urlsImages.size() + ".jpg");
            }

        } catch (HeadlessException | IOException ex) {
            JOptionPane.showMessageDialog(this, "Error al cargar imagen", "Error", JOptionPane.ERROR_MESSAGE);
            System.out.println("Error en alta cliente: " + ex.getMessage());
        }
    }//GEN-LAST:event_btnAddImagenesMouseClicked

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

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

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

    /**
     * @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 code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FUsuarios.class.getName()).log(java.util.logging.Level.SEVERE, null,
                    ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FUsuarios().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JInternalFrame ICategoriasDisponibles;
    private javax.swing.JInternalFrame IRegistrarCliente;
    private javax.swing.JInternalFrame IRegistrarRestaurante;
    private javax.swing.JButton brnRestCancelar;
    private javax.swing.JButton btnAddImagenes;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnCatRemover;
    private javax.swing.JButton btnCategoriaAdd;
    private javax.swing.JButton btnCategoriaOk;
    private javax.swing.JButton btnImagen;
    private javax.swing.JButton btnRegistrarCliente;
    private javax.swing.JButton btnRestRegistrar;
    private javax.swing.JButton btnSelectCategorias;
    private javax.swing.JSpinner drpDay;
    private javax.swing.JSpinner drpMes;
    private javax.swing.JSpinner drpYear;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPasswordField jPasswordField1;
    private javax.swing.JPasswordField jPasswordField2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JList lstCategorias;
    private javax.swing.JList lstCategoriasSeleccionadas;
    private javax.swing.JMenu menuRegistrarRestaurante;
    private javax.swing.JMenu menuRegistrarcliente;
    private javax.swing.JTextField txtApellido;
    private javax.swing.JTextField txtDireccion;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtNickName;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtRestCorreo;
    private javax.swing.JTextField txtRestDir;
    private javax.swing.JTextField txtRestNickname;
    private javax.swing.JTextField txtRestNombre;
    // End of variables declaration//GEN-END:variables
}