/* 
* Copyright 2016 Agencia Estatal de Administración Tibutaria
*
* Licencia con arreglo a la EUPL, Versión 1.1 o –en cuanto
* sean aprobadas por la Comisión Europea– versiones
* posteriores de la EUPL (la «Licencia»);
* Solo podrá usarse esta obra si se respeta la Licencia.
* Puede obtenerse una copia de la Licencia en:
*  
* https://joinup.ec.europa.eu/software/page/eupl
*  
* Salvo cuando lo exija la legislación aplicable o se acuerde
* por escrito, el programa distribuido con arreglo a la
* Licencia se distribuye «TAL CUAL», SIN GARANTÍAS NI CONDICIONES
* DE NINGÚN TIPO, ni expresasni implícitas.
*
* Véase la Licencia en el idioma concreto que rige los permisos y 
* limitaciones que establece la Licencia.
*/ 

package gestor;

import gestor.utiles.*;
import gestor.utiles.ISmartCardAvisable;
import java.awt.*;
import java.util.*;
import java.util.logging.Level;
import javax.swing.*;
import gestor.datos.*;
import java.awt.font.TextAttribute;

public final class DlgPedirNif extends javax.swing.JDialog implements ISmartCardAvisable {

    boolean finalizar = false;
    javax.swing.Timer timerCierraAviso;
    TablaCandidatos tabla;
    RegistroCandidatos regActual = null;
    public PanelTactil padre;
    long ahoraMismo;
    boolean cerrarSolo = true;
    boolean profesional;
    //String mostrarNifYaTecleado = null;
    boolean ventanaVisible = false;
    Font fuenteG = new java.awt.Font("MS Sans Serif", 3, 36);
    Font fuenteP = new java.awt.Font("MS Sans Serif", 3, 28);

    public DlgPedirNif(PanelTactil padre, boolean profesionales, String textoBoton) {
        super(padre, true);
        this.padre = padre;
        profesional = profesionales;
        tabla = TablaCandidatos.getTablaCandidatos();
        preparaVisual(textoBoton);
    }

    public DlgPedirNif(PanelTactil padre, String nif) {
        super(padre, true);
        this.padre = padre;
        tabla = TablaCandidatos.getTablaCandidatos();
        ProcesarNif(nif);
    }

    void preparaVisual(String textoBoton) {
        ventanaVisible = true;
        initComponents();
        Font font = jLabel1.getFont();
        Map attributes = font.getAttributes();
        attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
        jLabel1.setFont(font.deriveFont(attributes));
        preparaTimerAviso();

        jLabel2.setText(Global.trad.valor("Servicios con Cita Previa"));
        jLabel3.setText(textoBoton);

        if (!Configuracion.instanciaUnica().cursorVisible) {
            setCursor(gestor.utiles.Global.mainForm.cursorTransparente);
        }
        btBorrar.setText(Global.trad.valor("Borrar"));
        btSalir.setText(Global.trad.valor("Salir"));
        if (!Configuracion.instanciaUnica().permitirNoIden) {
            this.boton_R1.setEnabled(false);
        }
        ajustar();

//      if (Global.mainForm.lectorSC.hayTarjetaPresente()) {
//         LectorSmartCard.DatosDNIe datos = Global.mainForm.lectorSC.leerDNIe();
//         padre.haUsadoDNIe = true;
//         edNIF.setText(datos.nif);
//      }
//      Global.mainForm.lectorSC.registrarVentanaAvisable(this);
    }

    @Override
    public void avisoSmartCardInsertada(String nif, String nombre) {
        try {
            edNIF.setText(nif);
            BuscarNifEnTabla(null);
        } catch (Exception exc) {
            // por ahora, no queremos ningun tratamiento para esta excepcion.
            // Simplemente, no hacemos nada
        }
    }

    @Override
    public void avisoSmartCardExtraida() {
    }

    public void ponerFoco() {
        edNIF.requestFocus();
    }

    void salvaPantalla(boolean activar) {
        if (!cerrarSolo) {
            if (activar) {
                Global.mainForm.activarSalvaPantalla();
            } else {
                Global.mainForm.desactivarSalvaPantalla();
            }
        }
    }

    public void ajustar() {
        //jPanel1.getLayout().layoutContainer(this.getContentPane());
        Rectangle rec = btSalir.getBounds();
        int alto = rec.y + rec.height + 30;
        int ancho = rec.x + rec.width + 30;
        this.setSize(ancho, alto);
        this.jPanel1.setSize(ancho, alto);
        this.setLocationRelativeTo(padre);
    }

    public void ajustarDlgCitaPrevia(DlgSeleccionarCitaPrevia dlg) {
        if (ventanaVisible) {
            int posSup = btBorrar.getY();
            int alto = getHeight() - posSup + 4;
            dlg.setSize(getWidth() - 8, alto);
            dlg.setLocation(getX() + 4, getY() + posSup - 10);
            dlg.quitarBorde();
        } else {
            //    dlg.setSize(1000,950);
            dlg.setLocationRelativeTo(padre);
        }
    }

    void cerrarCon(boolean valor) {
        // poner aviso sonoro...
        finalizar = valor;
        timerCierraAviso.stop();
        cerrarVentana();
    }

    void preparaTimerAviso() {
        timerCierraAviso = new javax.swing.Timer(Configuracion.instanciaUnica().segundosCierreVentanas * 1000, new java.awt.event.ActionListener() {

            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cerrarCon(false);
            }
        });
    }

    public void ProcesarNif(String nif) {
        if (ventanaVisible) {
            timerCierraAviso.stop();
        }
        try {
            ahoraMismo = System.currentTimeMillis();
            ArrayList<RegistroCandidatos> citas = new ArrayList<>();
            int valBuscarNif = BuscarNif(nif, citas);

            if (valBuscarNif == -99) {
                cerrarVentana();
                return;
            }
            switch (valBuscarNif) {
                case -1:
                    SinCita(nif);
                    break;
                case 0:
                    ConCitaAtendida();
                    break;
                case 1:
                    int r = Global.compruebaHoraCalculada(ahoraMismo, regActual.horaCita.getTime());
                    if (r == 3) {
                        FueradeHora();
                        break;
                    } else if (ConHoraValidaNoMultiple()) {
                        ConfirmarCambios(r);
                        break;
                    }
                    break;
                case 2:
                    ProcesarMultiple();
                    break;
                case 3:
                    ConfirmarCambios(0);
                    break;
            }
        } catch (Exception exc) {
            exc.printStackTrace();
            Main.log.log(Level.WARNING, "Error en ProcesarNif", exc);
        }
        if (cerrarSolo && ventanaVisible) {
            timerCierraAviso.start();
        }
    }

    public void ProcesarMultiple() {
        String nifVinculados;
        TablaCandidatos miniTabla = new TablaCandidatos();
        nifVinculados = tabla.getnifVinculados(regActual.citaVinculada, miniTabla);
        DlgConfirmarCita confirmarcita = new DlgConfirmarCita(padre);
        confirmarcita.setNif("NIF: " + regActual.nif);
        confirmarcita.setNombre(Global.trad.valor("nombre:") + " " + regActual.nombre);
        confirmarcita.setHora(Global.trad.valor("hora de la cita:") + " " + Fecha.formatoHoraHM(regActual.horaCita));
        confirmarcita.setCitas(Global.trad.valor("numCitas:") + " " + regActual.citaMultiple);
        String estado = Global.trad.valor("estadoPendiente");
        confirmarcita.setEstado(estado);
        confirmarcita.setMultiple(ponerHTML(nifVinculados));

        boolean lleganTarde = false;
        RegistroCandidatos regm = miniTabla.primeroEnHora();
        if (regm == null) {
            lleganTarde = true;
            confirmarcita.setAceptarVisible(false);
            confirmarcita.setMultipleTexto1(ponerHTML(Global.trad.valor("vinculadosFueraHora")));
            confirmarcita.soloAceptar();
        } else {
            confirmarcita.setAceptarVisible(true);
            confirmarcita.setMultipleTexto1(ponerHTML(Global.trad.valor("msjCitaMultiple")));
        }
        salvaPantalla(false);
        confirmarcita.setVisible(true);
        boolean emitirT = confirmarcita.emitirTicket;
        confirmarcita.dispose();
        confirmarcita = null;
        Global.mainForm.resetMemoria();
        salvaPantalla(true);
        if (!lleganTarde) {
            if (emitirT) {
                java.sql.Timestamp horaCalculada = regm.horaCalculada;
                regm.cambiaEstado("P", new java.sql.Timestamp(ahoraMismo), horaCalculada);
                miniTabla.cabiaEstadoVinculados(regm.citaVinculada, "X", new java.sql.Timestamp(ahoraMismo), horaCalculada);
            }
        }
    }

    public boolean ConHoraValidaNoMultiple() {
        DlgConfirmarCita confirmarcita = new DlgConfirmarCita(padre);
        confirmarcita.setNif("NIF: " + regActual.nif);
        confirmarcita.setNombre(Global.trad.valor("nombre:") + " " + regActual.nombre);
        confirmarcita.setHora(Global.trad.valor("hora de la cita:") + " " + Fecha.formatoHoraHM(regActual.horaCita));
        confirmarcita.setCitas(Global.trad.valor("numCitas:") + " " + regActual.citaMultiple);
        String estado = Global.trad.valor("estadoPendiente");
        confirmarcita.setEstado(estado);
        confirmarcita.setAceptarVisible(true);
        salvaPantalla(false);
        confirmarcita.setVisible(true);
        boolean EmitirT = confirmarcita.emitirTicket;
        confirmarcita.dispose();
        confirmarcita = null;
        salvaPantalla(true);
        Global.mainForm.resetMemoria();
        return EmitirT;
    }

    public void ConfirmarCambios(int r) {
        java.sql.Timestamp cita = regActual.horaCita;
        java.sql.Timestamp horaCalculada;
        horaCalculada = cita;
        if (r == 0) {
            horaCalculada = cita;
        } else if (r == 1) {
            horaCalculada = new java.sql.Timestamp(ahoraMismo);
        } else if (r == 2) {
            horaCalculada = new java.sql.Timestamp(ahoraMismo + Configuracion.instanciaUnica().margenPenalizacion);
        }
        regActual.cambiaEstado("P", new java.sql.Timestamp(ahoraMismo), horaCalculada);
    }

    public void SinCita(String nif) {
        DlgMensajeGenerico sinCita = new DlgMensajeGenerico(padre);
        sinCita.setLinea1(" Identificación fiscal: " + nif);
        sinCita.setLinea2(Global.trad.valor("noTieneCita"));
        sinCita.setLinea3(ponerHTML(Global.trad.valor("msjNoTieneCita")));
        salvaPantalla(false);
        sinCita.setVisible(true);
        salvaPantalla(true);
    }

    public void ConCitaAtendida() {
        DlgConfirmarCita confirmarcita = new DlgConfirmarCita(padre);
        confirmarcita.setNif("Identificación fiscal: " + regActual.nif);
        confirmarcita.setNombre(Global.trad.valor("nombre:") + " " + regActual.nombre);
        confirmarcita.setHora(Global.trad.valor("hora de la Cita:") + " " + Fecha.formatoHoraHM(regActual.horaCita));
        int numero = regActual.citaMultiple;
        confirmarcita.setCitas(Global.trad.valor("numCitas:") + " " + numero);
        String estado = Global.trad.valor("estadoEmitido");
        confirmarcita.setEstado(estado, true);
        if (numero > 1) {
            confirmarcita.setMultipleTexto1(ponerHTML(Global.trad.valor("msjCitaMultiple")));
            String Multiple = tabla.getnifVinculados(regActual.citaVinculada);
            confirmarcita.setMultiple(ponerHTML(Multiple));
        }
        salvaPantalla(false);
        confirmarcita.setVisible(true);
        confirmarcita.dispose();
        confirmarcita = null;
        Global.mainForm.resetMemoria();
        salvaPantalla(true);
    }

    public void FueradeHora() {
        DlgConfirmarCita confirmarcita = new DlgConfirmarCita(padre);
        confirmarcita.setNif("Identificación fiscal: " + regActual.nif);
        confirmarcita.setNombre(Global.trad.valor("nombre:") + " " + regActual.nombre);
        confirmarcita.setHora(Global.trad.valor("hora de la Cita:") + " " + Fecha.formatoHoraHM(regActual.horaCita));
        int numero = regActual.citaMultiple;
        confirmarcita.setCitas(Global.trad.valor("citaConRetraso"), true);
        String estado = ponerHTML(Global.trad.valor("msjNoSeraAtendida"));
        confirmarcita.setEstado(estado, false);
        if (numero > 1) {
            confirmarcita.setMultipleTexto1(Global.trad.valor("citaMultiple"));
            String Multiple = tabla.getnifVinculados(regActual.citaVinculada);
            confirmarcita.setMultiple(ponerHTML(Multiple));
        }
        salvaPantalla(false);
        confirmarcita.setVisible(true);
        confirmarcita.dispose();
        confirmarcita = null;
        Global.mainForm.resetMemoria();
        salvaPantalla(true);
    }

    public int BuscarNif(String nif, ArrayList<RegistroCandidatos> citas) {
        if (nif.equals("00000000")) {
            return -1;
        }
        regActual = tabla.buscarTodosConNif(nif, citas);
        if (regActual == null && tabla.malas > 0) {
            return -99;
        }
        int r = tabla.comprobarEstadoCitas(citas);
        if (r == 3) {
            DlgSeleccionarCitaPrevia dlgCita = new DlgSeleccionarCitaPrevia(this, citas);
            dlgCita.setVisible(true);
            if (dlgCita.idSeleccionado != 0) {
                regActual = tabla.buscarPorId(dlgCita.idSeleccionado);
            } else {
                r = -2;
            }
            dlgCita.dispose();
            dlgCita = null;

            if (ventanaVisible) {
                cerrarCon(false);
            }
        }
        return r;
    }

    public void borrarNif() {
        edNIF.setText("");
        edNIF.setFont(fuenteG);
        ponerFoco();
    }

    public void ModificarNif(String Caracter) {
        try {
            String Valor = edNIF.getText().trim() + Caracter;
            edNIF.setText(Valor);
            boolean esNum = Character.isDigit(Valor.charAt(0));
            if (Valor.startsWith("#") && Valor.length() < 16) {
                return;
            }
            if ((esNum && Valor.length() > 7) || (!esNum && Valor.length() > 8)) {
                BuscarNifEnTabla(null);
                borrarNif();
            }
        } catch (Exception exc) {
            exc.printStackTrace();
            Main.log.log(Level.WARNING, "Error en ModificarNif", exc);
        }
    }

    public void ModificarNifLetra(String caracter) {
        String valor = edNIF.getText();
        if (edNIF.getText().startsWith("#")) {
            return;
        }
        edNIF.setText("#" + valor);
    }

    public String largoMinimo(String s) {
        int n = s.length();
        if (n == 0) {
            return "";
        }
        if (n >= 9) {
            return s;
        }
        StringBuilder sb = new StringBuilder();
        if (s.startsWith("#")) {
            sb.append('#');
            for (int i = 0; i < 8 - n + 1; i++) {
                sb.append('0');
            }
            sb.append(s.substring(1));
        } else {
            for (int i = 0; i < 8 - n; i++) {
                sb.append('0');
            }
            sb.append(s);
        }
        //   sb.append(s);
        return sb.toString();
    }

    String ponerHTML(String s) {
        return "<html><body>" + s + "</body></html>";
    }

    void mostrarAyudaNif() {
        DlgOtrosNif dlgnif = new DlgOtrosNif(null);
        dlgnif.setVisible(true);
        dlgnif.dispose();
        dlgnif = null;
    }

    public void pulsadoTeclado(java.awt.event.KeyEvent evt) {
        String Valor = edNIF.getText().trim() + evt.getKeyChar();
        edNIF.setText(Valor);
        evt.consume();
        timerCierraAviso.restart();

//      if (Valor.length() > 7 && !edNIF.getText().trim().startsWith("#")) {
//         edNIF.setText(Valor);
//         evt.consume();
//         timerCierraAviso.restart();
//         return;
//        // BuscarNifEnTabla(null);
//       //  borrarNif();
//      } else {
//         if (cerrarSolo) {
//            timerCierraAviso.restart();
//         }
//      }
    }

    private void cerrarVentana() {
        if (ventanaVisible) {
            Global.mainForm.lectorSC.registrarVentanaAvisable(null);
            Global.mainForm.lectorSC.mostrarDialogoExtraerTarjeta(padre);
            salvaPantalla(true);
            setVisible(false);
        }
    }

    /**
     * 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.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jPanel1 = new MiPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        edNIF = new javax.swing.JTextField();
        botonOK = new gestor.utiles.MiBoton();
        btBorrar = new gestor.utiles.MiBoton();
        btSalir = new gestor.utiles.MiBoton();
        boton_1 = new gestor.utiles.MiBoton();
        boton_2 = new gestor.utiles.MiBoton();
        boton_3 = new gestor.utiles.MiBoton();
        boton_4 = new gestor.utiles.MiBoton();
        boton_5 = new gestor.utiles.MiBoton();
        boton_6 = new gestor.utiles.MiBoton();
        boton_7 = new gestor.utiles.MiBoton();
        boton_8 = new gestor.utiles.MiBoton();
        boton_9 = new gestor.utiles.MiBoton();
        boton_0 = new gestor.utiles.MiBoton();
        boton_A = new gestor.utiles.MiBoton();
        boton_B = new gestor.utiles.MiBoton();
        boton_C = new gestor.utiles.MiBoton();
        boton_D = new gestor.utiles.MiBoton();
        boton_E = new gestor.utiles.MiBoton();
        boton_F = new gestor.utiles.MiBoton();
        boton_G = new gestor.utiles.MiBoton();
        boton_H = new gestor.utiles.MiBoton();
        boton_J = new gestor.utiles.MiBoton();
        boton_K = new gestor.utiles.MiBoton();
        boton_L = new gestor.utiles.MiBoton();
        boton_M = new gestor.utiles.MiBoton();
        boton_N = new gestor.utiles.MiBoton();
        boton_P = new gestor.utiles.MiBoton();
        boton_Q = new gestor.utiles.MiBoton();
        boton_R = new gestor.utiles.MiBoton();
        boton_S = new gestor.utiles.MiBoton();
        boton_U = new gestor.utiles.MiBoton();
        boton_V = new gestor.utiles.MiBoton();
        boton_W = new gestor.utiles.MiBoton();
        boton_X = new gestor.utiles.MiBoton();
        boton_Y = new gestor.utiles.MiBoton();
        boton_Z = new gestor.utiles.MiBoton();
        boton_R1 = new gestor.utiles.MiBoton();
        boton_R2 = new gestor.utiles.MiBoton();
        boton_R3 = new gestor.utiles.MiBoton();
        boton_R4 = new gestor.utiles.MiBoton();
        boton_X1 = new gestor.utiles.MiBoton();

        jButton9.setText("jButton9");

        jButton10.setText("jButton10");

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setModal(true);
        setUndecorated(true);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                formComponentShown(evt);
            }
        });
        addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                formMouseMoved(evt);
            }
        });
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });
        getContentPane().setLayout(null);

        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204), 6));
        jPanel1.setMinimumSize(new java.awt.Dimension(1000, 850));
        jPanel1.setPreferredSize(new java.awt.Dimension(1000, 850));
        jPanel1.setLayout(null);

        jLabel1.setFont(new java.awt.Font("MS Sans Serif", 3, 22)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 51, 51));
        jLabel1.setText("Identificación fiscal");
        jLabel1.setToolTipText("");
        jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel1MouseClicked(evt);
            }
        });
        jPanel1.add(jLabel1);
        jLabel1.setBounds(230, 90, 210, 80);

        jLabel2.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("Servicios con Cita Previa");
        jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jPanel1.add(jLabel2);
        jLabel2.setBounds(10, 30, 980, 39);

        jLabel3.setFont(new java.awt.Font("MS Sans Serif", 1, 30)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jPanel1.add(jLabel3);
        jLabel3.setBounds(20, 50, 870, 40);

        edNIF.setBackground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
        edNIF.setColumns(14);
        edNIF.setFont(new java.awt.Font("MS Sans Serif", 3, 30)); // NOI18N
        edNIF.setToolTipText("<html>Si es un documento distinto de  Identificación fiscal.<br /> Primer  dígito <b> '#' <br />Obligatorio 9 caracteres</b>");
        edNIF.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                edNIFKeyTyped(evt);
            }
        });
        jPanel1.add(edNIF);
        edNIF.setBounds(450, 100, 300, 50);

        botonOK.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        botonOK.setForeground(new java.awt.Color(255, 51, 51));
        botonOK.setText(Global.trad.valor("Aceptar"));
        botonOK.setFocusable(false);
        botonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BuscarNifEnTabla(evt);
            }
        });
        jPanel1.add(botonOK);
        botonOK.setBounds(760, 100, 240, 55);

        btBorrar.setFont(new java.awt.Font("MS Sans Serif", 3, 20)); // NOI18N
        btBorrar.setText("Borrar");
        btBorrar.setFocusable(false);
        btBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BorrarDatosNif(evt);
            }
        });
        jPanel1.add(btBorrar);
        btBorrar.setBounds(20, 100, 190, 56);

        btSalir.setFont(new java.awt.Font("MS Sans Serif", 3, 20)); // NOI18N
        btSalir.setText("Salir");
        btSalir.setFocusable(false);
        btSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSalirActionPerformed(evt);
            }
        });
        jPanel1.add(btSalir);
        btSalir.setBounds(750, 620, 240, 70);

        boton_1.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_1.setText("1");
        boton_1.setFocusable(false);
        boton_1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_1);
        boton_1.setBounds(490, 210, 130, 90);

        boton_2.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_2.setText("2");
        boton_2.setFocusable(false);
        boton_2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_2);
        boton_2.setBounds(640, 210, 130, 90);

        boton_3.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_3.setText("3");
        boton_3.setFocusable(false);
        boton_3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_3);
        boton_3.setBounds(790, 210, 130, 90);

        boton_4.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_4.setText("4");
        boton_4.setFocusable(false);
        boton_4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_4);
        boton_4.setBounds(490, 310, 130, 90);

        boton_5.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_5.setText("5");
        boton_5.setFocusable(false);
        boton_5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_5);
        boton_5.setBounds(640, 310, 130, 90);

        boton_6.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_6.setText("6");
        boton_6.setFocusable(false);
        boton_6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_6);
        boton_6.setBounds(790, 310, 130, 90);

        boton_7.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_7.setText("7");
        boton_7.setFocusable(false);
        boton_7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_7);
        boton_7.setBounds(490, 410, 130, 90);

        boton_8.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_8.setText("8");
        boton_8.setFocusable(false);
        boton_8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_8);
        boton_8.setBounds(640, 410, 130, 90);

        boton_9.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_9.setText("9");
        boton_9.setFocusable(false);
        boton_9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_9);
        boton_9.setBounds(790, 410, 130, 90);

        boton_0.setFont(new java.awt.Font("MS Sans Serif", 3, 36)); // NOI18N
        boton_0.setText("0");
        boton_0.setFocusable(false);
        boton_0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoNumero(evt);
            }
        });
        jPanel1.add(boton_0);
        boton_0.setBounds(640, 510, 130, 90);

        boton_A.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_A.setForeground(new java.awt.Color(51, 51, 255));
        boton_A.setText("A");
        boton_A.setToolTipText("");
        boton_A.setFocusable(false);
        boton_A.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_A.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_A);
        boton_A.setBounds(20, 210, 90, 60);

        boton_B.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_B.setForeground(new java.awt.Color(51, 51, 255));
        boton_B.setText("B");
        boton_B.setToolTipText("");
        boton_B.setFocusable(false);
        boton_B.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_B.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_B);
        boton_B.setBounds(20, 280, 90, 60);

        boton_C.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_C.setForeground(new java.awt.Color(51, 51, 255));
        boton_C.setText("C");
        boton_C.setToolTipText("");
        boton_C.setFocusable(false);
        boton_C.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_C.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_C);
        boton_C.setBounds(20, 350, 90, 60);

        boton_D.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_D.setForeground(new java.awt.Color(51, 51, 255));
        boton_D.setText("D");
        boton_D.setToolTipText("");
        boton_D.setFocusable(false);
        boton_D.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_D.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_D);
        boton_D.setBounds(20, 420, 90, 60);

        boton_E.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_E.setForeground(new java.awt.Color(51, 51, 255));
        boton_E.setText("E");
        boton_E.setToolTipText("");
        boton_E.setFocusable(false);
        boton_E.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_E.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_E);
        boton_E.setBounds(20, 490, 90, 60);

        boton_F.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_F.setForeground(new java.awt.Color(51, 51, 255));
        boton_F.setText("F");
        boton_F.setToolTipText("");
        boton_F.setFocusable(false);
        boton_F.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_F.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_F);
        boton_F.setBounds(20, 560, 90, 60);

        boton_G.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_G.setForeground(new java.awt.Color(51, 51, 255));
        boton_G.setText("G");
        boton_G.setToolTipText("");
        boton_G.setFocusable(false);
        boton_G.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_G.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_G);
        boton_G.setBounds(20, 630, 90, 60);

        boton_H.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_H.setForeground(new java.awt.Color(51, 51, 255));
        boton_H.setText("H");
        boton_H.setToolTipText("");
        boton_H.setFocusable(false);
        boton_H.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_H.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_H);
        boton_H.setBounds(120, 210, 90, 60);

        boton_J.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_J.setForeground(new java.awt.Color(51, 51, 255));
        boton_J.setText("J");
        boton_J.setToolTipText("");
        boton_J.setFocusable(false);
        boton_J.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_J.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_J);
        boton_J.setBounds(120, 350, 90, 60);

        boton_K.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_K.setForeground(new java.awt.Color(51, 51, 255));
        boton_K.setText("K");
        boton_K.setToolTipText("");
        boton_K.setFocusable(false);
        boton_K.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_K.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_K);
        boton_K.setBounds(120, 420, 90, 60);

        boton_L.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_L.setForeground(new java.awt.Color(51, 51, 255));
        boton_L.setText("L");
        boton_L.setToolTipText("");
        boton_L.setFocusable(false);
        boton_L.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_L.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_L);
        boton_L.setBounds(120, 490, 90, 60);

        boton_M.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_M.setForeground(new java.awt.Color(51, 51, 255));
        boton_M.setText("M");
        boton_M.setToolTipText("");
        boton_M.setFocusable(false);
        boton_M.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_M.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_M);
        boton_M.setBounds(120, 560, 90, 60);

        boton_N.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_N.setForeground(new java.awt.Color(51, 51, 255));
        boton_N.setText("N");
        boton_N.setToolTipText("");
        boton_N.setFocusable(false);
        boton_N.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_N.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_N);
        boton_N.setBounds(120, 630, 90, 60);

        boton_P.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_P.setForeground(new java.awt.Color(51, 51, 255));
        boton_P.setText("P");
        boton_P.setToolTipText("");
        boton_P.setFocusable(false);
        boton_P.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_P.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_P);
        boton_P.setBounds(220, 350, 90, 60);

        boton_Q.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_Q.setForeground(new java.awt.Color(51, 51, 255));
        boton_Q.setText("Q");
        boton_Q.setToolTipText("");
        boton_Q.setFocusable(false);
        boton_Q.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_Q.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_Q);
        boton_Q.setBounds(220, 420, 90, 60);

        boton_R.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_R.setForeground(new java.awt.Color(51, 51, 255));
        boton_R.setText("I");
        boton_R.setToolTipText("");
        boton_R.setFocusable(false);
        boton_R.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_R.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_R);
        boton_R.setBounds(120, 280, 90, 60);

        boton_S.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_S.setForeground(new java.awt.Color(51, 51, 255));
        boton_S.setText("S");
        boton_S.setToolTipText("");
        boton_S.setFocusable(false);
        boton_S.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_S.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_S);
        boton_S.setBounds(220, 560, 90, 60);

        boton_U.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_U.setForeground(new java.awt.Color(51, 51, 255));
        boton_U.setText("U");
        boton_U.setToolTipText("");
        boton_U.setFocusable(false);
        boton_U.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_U.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_U);
        boton_U.setBounds(320, 210, 90, 60);

        boton_V.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_V.setForeground(new java.awt.Color(51, 51, 255));
        boton_V.setText("V");
        boton_V.setToolTipText("");
        boton_V.setFocusable(false);
        boton_V.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_V.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_V);
        boton_V.setBounds(320, 280, 90, 60);

        boton_W.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_W.setForeground(new java.awt.Color(51, 51, 255));
        boton_W.setText("W");
        boton_W.setToolTipText("");
        boton_W.setFocusable(false);
        boton_W.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_W.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_W);
        boton_W.setBounds(320, 350, 90, 60);

        boton_X.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_X.setForeground(new java.awt.Color(51, 51, 255));
        boton_X.setText("T");
        boton_X.setToolTipText("");
        boton_X.setFocusable(false);
        boton_X.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_X.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_X);
        boton_X.setBounds(220, 630, 90, 60);

        boton_Y.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_Y.setForeground(new java.awt.Color(51, 51, 255));
        boton_Y.setText("Y");
        boton_Y.setToolTipText("");
        boton_Y.setFocusable(false);
        boton_Y.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_Y.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_Y);
        boton_Y.setBounds(320, 490, 90, 60);

        boton_Z.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_Z.setForeground(new java.awt.Color(51, 51, 255));
        boton_Z.setText("Z");
        boton_Z.setToolTipText("");
        boton_Z.setFocusable(false);
        boton_Z.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_Z.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_Z);
        boton_Z.setBounds(320, 560, 90, 60);

        boton_R1.setFont(new java.awt.Font("MS Sans Serif", 3, 18)); // NOI18N
        boton_R1.setForeground(new java.awt.Color(255, 51, 51));
        boton_R1.setText("No Nif");
        boton_R1.setToolTipText("");
        boton_R1.setFocusable(false);
        boton_R1.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_R1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_R1PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_R1);
        boton_R1.setBounds(320, 630, 90, 60);

        boton_R2.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_R2.setForeground(new java.awt.Color(51, 51, 255));
        boton_R2.setText("O");
        boton_R2.setToolTipText("");
        boton_R2.setFocusable(false);
        boton_R2.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_R2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_R2);
        boton_R2.setBounds(220, 280, 90, 60);

        boton_R3.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_R3.setForeground(new java.awt.Color(51, 51, 255));
        boton_R3.setText("R");
        boton_R3.setToolTipText("");
        boton_R3.setFocusable(false);
        boton_R3.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_R3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_R3);
        boton_R3.setBounds(220, 490, 90, 60);

        boton_R4.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_R4.setForeground(new java.awt.Color(51, 51, 255));
        boton_R4.setText("Ñ");
        boton_R4.setToolTipText("");
        boton_R4.setFocusable(false);
        boton_R4.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_R4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_R4);
        boton_R4.setBounds(220, 210, 90, 60);

        boton_X1.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
        boton_X1.setForeground(new java.awt.Color(51, 51, 255));
        boton_X1.setText("X");
        boton_X1.setToolTipText("");
        boton_X1.setFocusable(false);
        boton_X1.setPreferredSize(new java.awt.Dimension(80, 40));
        boton_X1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PulsadoLetra(evt);
            }
        });
        jPanel1.add(boton_X1);
        boton_X1.setBounds(320, 420, 90, 60);

        getContentPane().add(jPanel1);
        jPanel1.setBounds(0, 0, 1090, 770);
    }// </editor-fold>//GEN-END:initComponents
    private void formKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyPressed
        if (!cerrarSolo) {
            Global.mainForm.resetSalvaPantalla();
        }
    }//GEN-LAST:event_formKeyPressed

    private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
        if (!cerrarSolo) {
            Global.mainForm.resetSalvaPantalla();
        }
    }//GEN-LAST:event_formMouseMoved

    private void edNIFKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_edNIFKeyTyped
        pulsadoTeclado(evt);
    }//GEN-LAST:event_edNIFKeyTyped

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        if (cerrarSolo) {
            timerCierraAviso.start();
            Global.mainForm.desactivarSalvaPantalla();
        }
        ponerFoco();
    }//GEN-LAST:event_formWindowActivated

    private void btSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalirActionPerformed
        timerCierraAviso.stop();
        cerrarVentana();
    }//GEN-LAST:event_btSalirActionPerformed

    private void PulsadoLetra(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PulsadoLetra
        JButton boton = (JButton) evt.getSource();
        if (cerrarSolo) {
            timerCierraAviso.restart();
        }
        ModificarNif(boton.getText());
        // ModificarNifLetra(boton.getText());
        ponerFoco();
    }//GEN-LAST:event_PulsadoLetra

    private void BorrarDatosNif(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BorrarDatosNif
        borrarNif();
    }//GEN-LAST:event_BorrarDatosNif

    private void BuscarNifEnTabla(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BuscarNifEnTabla
        String nif = edNIF.getText().trim();
        // String nif = largoMinimo(edNIF.getText().trim());

        if (!nif.equals("")) {
            nif = nif.toUpperCase();

            ProcesarNif(nif);

            edNIF.setText("");
            edNIF.setFont(fuenteP);
        }
    }//GEN-LAST:event_BuscarNifEnTabla

    private void PulsadoNumero(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PulsadoNumero
        JButton boton = (JButton) evt.getSource();
        if (cerrarSolo) {
            timerCierraAviso.restart();
        }
        ModificarNif(boton.getText());
        ponerFoco();
    }//GEN-LAST:event_PulsadoNumero

    private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
    }//GEN-LAST:event_formComponentShown

    private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
        // TODO add your handling code here:
        mostrarAyudaNif();
    }//GEN-LAST:event_jLabel1MouseClicked

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

        JButton boton = (JButton) evt.getSource();
        if (cerrarSolo) {
            timerCierraAviso.restart();
        }
        edNIF.setFont(fuenteP);
        ModificarNifLetra("#");
        ponerFoco();
    }//GEN-LAST:event_boton_R1PulsadoLetra

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botonOK;
    private javax.swing.JButton boton_0;
    private javax.swing.JButton boton_1;
    private javax.swing.JButton boton_2;
    private javax.swing.JButton boton_3;
    private javax.swing.JButton boton_4;
    private javax.swing.JButton boton_5;
    private javax.swing.JButton boton_6;
    private javax.swing.JButton boton_7;
    private javax.swing.JButton boton_8;
    private javax.swing.JButton boton_9;
    private javax.swing.JButton boton_A;
    private javax.swing.JButton boton_B;
    private javax.swing.JButton boton_C;
    private javax.swing.JButton boton_D;
    private javax.swing.JButton boton_E;
    private javax.swing.JButton boton_F;
    private javax.swing.JButton boton_G;
    private javax.swing.JButton boton_H;
    private javax.swing.JButton boton_J;
    private javax.swing.JButton boton_K;
    private javax.swing.JButton boton_L;
    private javax.swing.JButton boton_M;
    private javax.swing.JButton boton_N;
    private javax.swing.JButton boton_P;
    private javax.swing.JButton boton_Q;
    private javax.swing.JButton boton_R;
    private javax.swing.JButton boton_R1;
    private javax.swing.JButton boton_R2;
    private javax.swing.JButton boton_R3;
    private javax.swing.JButton boton_R4;
    private javax.swing.JButton boton_S;
    private javax.swing.JButton boton_U;
    private javax.swing.JButton boton_V;
    private javax.swing.JButton boton_W;
    private javax.swing.JButton boton_X;
    private javax.swing.JButton boton_X1;
    private javax.swing.JButton boton_Y;
    private javax.swing.JButton boton_Z;
    private javax.swing.JButton btBorrar;
    private javax.swing.JButton btSalir;
    private javax.swing.JTextField edNIF;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
}
