Package Interfaz

Source Code of Interfaz.ModoEmpleo

package Interfaz;

import Funcion.Barrido;
import Manejo.ManejoClic;
import Manejo.MovimientoTablero;
import Manejo.Seleccion;
import Tipos.Tablero;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;

public class ModoEmpleo extends javax.swing.JDialog {
    int anterior= 1; // 0= manual
    public static Tablero t = Tablero.getInstance();
   
   
   
    public ModoEmpleo(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        ActualizarInterfaz();
        if (t.barrido== t.AUTOMATICO){
            cargarValoresAutomatico();
        }
        ActualizarIdioma();
    }
   
   
    // <editor-fold defaultstate="collapsed" desc=" C�digo Generado  ">//GEN-BEGIN:initComponents
    private void initComponents() {
        buttonGroupSeleccion = new javax.swing.ButtonGroup();
        buttonGroupBarrido = new javax.swing.ButtonGroup();
        buttonGroupManual = new javax.swing.ButtonGroup();
        buttonGroupEntrada = new javax.swing.ButtonGroup();
        buttonGroupAutomatico = new javax.swing.ButtonGroup();
        jPanelSeleccion = new javax.swing.JPanel();
        jRadioButtonRaton = new javax.swing.JRadioButton();
        jRadioButtonTeclado = new javax.swing.JRadioButton();
        jRadioButtonMicrofono = new javax.swing.JRadioButton();
        jButtonConf = new javax.swing.JButton();
        jPanelBarrido = new javax.swing.JPanel();
        jRadioButtonAutomatico = new javax.swing.JRadioButton();
        jRadioButtonManual = new javax.swing.JRadioButton();
        jRadioButtonFilas = new javax.swing.JRadioButton();
        jRadioButtonColumnas = new javax.swing.JRadioButton();
        jRadioButtonFilCol = new javax.swing.JRadioButton();
        jRadioButtonNinguno = new javax.swing.JRadioButton();
        jLabelEntrada = new javax.swing.JLabel();
        jRadioButtonBarrRaton = new javax.swing.JRadioButton();
        jRadioButtonBarrTeclado = new javax.swing.JRadioButton();
        jRadioButtonBarrMicrofono = new javax.swing.JRadioButton();
        jButtonConfBarr = new javax.swing.JButton();
        barridoSecuencial = new javax.swing.JRadioButton();
        barridoSecuencialCol = new javax.swing.JRadioButton();
        barridoFilas = new javax.swing.JRadioButton();
        barridoColumnas = new javax.swing.JRadioButton();
        etiPasadas1 = new javax.swing.JLabel();
        pasadas = new javax.swing.JSpinner();
        etiPasadas2 = new javax.swing.JLabel();
        aceptar = new javax.swing.JButton();
        cancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Manejo de entradas");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);
        getAccessibleContext().setAccessibleParent(this);
        jPanelSeleccion.setBorder(javax.swing.BorderFactory.createTitledBorder("Selecci\u00f3n"));
        buttonGroupSeleccion.add(jRadioButtonRaton);
        jRadioButtonRaton.setText("Clic del rat\u00f3n");
        jRadioButtonRaton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonRaton.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonRaton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonRatonStateChanged(evt);
            }
        });

        buttonGroupSeleccion.add(jRadioButtonTeclado);
        jRadioButtonTeclado.setSelected(true);
        jRadioButtonTeclado.setText("Teclado");
        jRadioButtonTeclado.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonTeclado.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonTeclado.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonTecladoStateChanged(evt);
            }
        });

        buttonGroupSeleccion.add(jRadioButtonMicrofono);
        jRadioButtonMicrofono.setText("Micr\u00f3fono");
        jRadioButtonMicrofono.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonMicrofono.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonMicrofono.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonMicrofonoStateChanged(evt);
            }
        });

        jButtonConf.setText("Configurar");
        jButtonConf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelSeleccionLayout = new javax.swing.GroupLayout(jPanelSeleccion);
        jPanelSeleccion.setLayout(jPanelSeleccionLayout);
        jPanelSeleccionLayout.setHorizontalGroup(
            jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jRadioButtonRaton)
                    .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                        .addComponent(jRadioButtonTeclado)
                        .addGap(115, 115, 115)
                        .addComponent(jButtonConf))
                    .addComponent(jRadioButtonMicrofono))
                .addContainerGap(187, Short.MAX_VALUE))
        );
        jPanelSeleccionLayout.setVerticalGroup(
            jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                .addComponent(jRadioButtonRaton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonTeclado)
                    .addComponent(jButtonConf))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jRadioButtonMicrofono)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        jPanelBarrido.setBorder(javax.swing.BorderFactory.createTitledBorder("Barrido"));
        buttonGroupBarrido.add(jRadioButtonAutomatico);
        jRadioButtonAutomatico.setSelected(true);
        jRadioButtonAutomatico.setText("Autom\u00e1tico");
        jRadioButtonAutomatico.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonAutomatico.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonAutomatico.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonAutomaticoStateChanged(evt);
            }
        });

        buttonGroupBarrido.add(jRadioButtonManual);
        jRadioButtonManual.setText("Manual");
        jRadioButtonManual.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonManual.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonManual.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonManualStateChanged(evt);
            }
        });

        buttonGroupManual.add(jRadioButtonFilas);
        jRadioButtonFilas.setText("Por filas");
        jRadioButtonFilas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonFilas.setEnabled(false);
        jRadioButtonFilas.setMargin(new java.awt.Insets(0, 0, 0, 0));

        buttonGroupManual.add(jRadioButtonColumnas);
        jRadioButtonColumnas.setSelected(true);
        jRadioButtonColumnas.setText("Por columnas");
        jRadioButtonColumnas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonColumnas.setEnabled(false);
        jRadioButtonColumnas.setMargin(new java.awt.Insets(0, 0, 0, 0));

        buttonGroupManual.add(jRadioButtonFilCol);
        jRadioButtonFilCol.setText("Por filas y columnas");
        jRadioButtonFilCol.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonFilCol.setEnabled(false);
        jRadioButtonFilCol.setMargin(new java.awt.Insets(0, 0, 0, 0));

        buttonGroupBarrido.add(jRadioButtonNinguno);
        jRadioButtonNinguno.setText("Ninguno");
        jRadioButtonNinguno.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonNinguno.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonNinguno.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonNingunoStateChanged(evt);
            }
        });

        jLabelEntrada.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelEntrada.setText("Entrada");
        jLabelEntrada.setEnabled(false);

        buttonGroupEntrada.add(jRadioButtonBarrRaton);
        jRadioButtonBarrRaton.setSelected(true);
        jRadioButtonBarrRaton.setText("Clic del rat\u00f3n");
        jRadioButtonBarrRaton.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonBarrRaton.setEnabled(false);
        jRadioButtonBarrRaton.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonBarrRaton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonBarrRatonStateChanged(evt);
            }
        });

        buttonGroupEntrada.add(jRadioButtonBarrTeclado);
        jRadioButtonBarrTeclado.setText("Teclado");
        jRadioButtonBarrTeclado.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonBarrTeclado.setEnabled(false);
        jRadioButtonBarrTeclado.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonBarrTeclado.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonBarrTecladoStateChanged(evt);
            }
        });

        buttonGroupEntrada.add(jRadioButtonBarrMicrofono);
        jRadioButtonBarrMicrofono.setText("Micr\u00f3fono");
        jRadioButtonBarrMicrofono.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButtonBarrMicrofono.setEnabled(false);
        jRadioButtonBarrMicrofono.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jRadioButtonBarrMicrofono.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonBarrMicrofonoStateChanged(evt);
            }
        });

        jButtonConfBarr.setText("Configurar");
        jButtonConfBarr.setEnabled(false);
        jButtonConfBarr.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConfBarrActionPerformed(evt);
            }
        });

        buttonGroupAutomatico.add(barridoSecuencial);
        barridoSecuencial.setText("Barrido secuencial por filas");
        barridoSecuencial.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        barridoSecuencial.setMargin(new java.awt.Insets(0, 0, 0, 0));
        barridoSecuencial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                barridoSecuencialActionPerformed(evt);
            }
        });

        buttonGroupAutomatico.add(barridoSecuencialCol);
        barridoSecuencialCol.setText("Barrido secuencial por columnas");
        barridoSecuencialCol.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        barridoSecuencialCol.setMargin(new java.awt.Insets(0, 0, 0, 0));
        barridoSecuencialCol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                barridoSecuencialColbarridoSecuencialActionPerformed(evt);
            }
        });

        buttonGroupAutomatico.add(barridoFilas);
        barridoFilas.setText("Barrido por filas (dos fases)");
        barridoFilas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        barridoFilas.setMargin(new java.awt.Insets(0, 0, 0, 0));
        barridoFilas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                barridoFilasbarridoFasesActionPerformed(evt);
            }
        });

        buttonGroupAutomatico.add(barridoColumnas);
        barridoColumnas.setText("Barrido por columnas (dos fases)");
        barridoColumnas.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        barridoColumnas.setMargin(new java.awt.Insets(0, 0, 0, 0));
        barridoColumnas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                barridoColumnasbarridoFasesActionPerformed(evt);
            }
        });

        etiPasadas1.setText("<html>Segunda fase del <p>barrido desactivada tras</html>");

        etiPasadas2.setText("pasada/s");
        etiPasadas2.setRequestFocusEnabled(false);
        etiPasadas2.setVerifyInputWhenFocusTarget(false);

        javax.swing.GroupLayout jPanelBarridoLayout = new javax.swing.GroupLayout(jPanelBarrido);
        jPanelBarrido.setLayout(jPanelBarridoLayout);
        jPanelBarridoLayout.setHorizontalGroup(
            jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBarridoLayout.createSequentialGroup()
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                        .addGap(59, 59, 59)
                        .addComponent(etiPasadas1)
                        .addGap(32, 32, 32)
                        .addComponent(pasadas, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addComponent(etiPasadas2))
                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(barridoSecuencialCol)
                            .addComponent(barridoSecuencial, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(barridoFilas, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                            .addComponent(barridoColumnas, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)))
                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                        .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelBarridoLayout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButtonAutomatico)
                                    .addComponent(jRadioButtonNinguno)
                                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                                        .addComponent(jRadioButtonManual)
                                        .addGap(177, 177, 177)
                                        .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jRadioButtonBarrRaton)
                                            .addComponent(jLabelEntrada)
                                            .addComponent(jRadioButtonBarrTeclado)
                                            .addComponent(jRadioButtonBarrMicrofono)))))
                            .addGroup(jPanelBarridoLayout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButtonFilCol)
                                    .addComponent(jRadioButtonColumnas)
                                    .addComponent(jRadioButtonFilas))))
                        .addGap(25, 25, 25)
                        .addComponent(jButtonConfBarr)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanelBarridoLayout.setVerticalGroup(
            jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelBarridoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jRadioButtonAutomatico)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(barridoSecuencial)
                    .addComponent(barridoFilas))
                .addGap(19, 19, 19)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(barridoSecuencialCol)
                    .addComponent(barridoColumnas))
                .addGap(20, 20, 20)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(etiPasadas1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(pasadas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(etiPasadas2))
                .addGap(50, 50, 50)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonManual)
                    .addComponent(jLabelEntrada))
                .addGap(19, 19, 19)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonFilas)
                    .addComponent(jRadioButtonBarrRaton, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonColumnas)
                    .addComponent(jRadioButtonBarrTeclado)
                    .addComponent(jButtonConfBarr))
                .addGroup(jPanelBarridoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jRadioButtonFilCol)
                        .addGap(25, 25, 25)
                        .addComponent(jRadioButtonNinguno))
                    .addGroup(jPanelBarridoLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jRadioButtonBarrMicrofono)))
                .addContainerGap())
        );

        aceptar.setText("Aceptar");
        aceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aceptarActionPerformed(evt);
            }
        });

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

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanelSeleccion, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanelBarrido, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(aceptar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cancelar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanelSeleccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelBarrido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(aceptar)
                    .addComponent(cancelar))
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarActionPerformed
        this.dispose();
    }//GEN-LAST:event_cancelarActionPerformed

   
    // Carga los valores al habilitar automatico
    private void habilitarAutomatico() {
       
        if (t.tipoTablero == t.T_HORIZONTAL)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
        else if (t.tipoTablero == t.T_VERTICAL)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
        else if (t.tipoTablero == t.T_CUADRICULA)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(true);
                this.barridoColumnas.setEnabled(true);
                this.pasadas.setEnabled(true);
        }
        else if (t.tipoTablero == t.T_SOLOBOTON)
        {
                this.barridoSecuencial.setEnabled(false);
                this.barridoSecuencialCol.setEnabled(false);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
      
    }
   
    // Carga los valores al habilitar automatico
    private void deshabilitarAutomatico() {
        this.barridoSecuencial.setEnabled(false);
        this.barridoSecuencialCol.setEnabled(false);
        this.barridoFilas.setEnabled(false);
        this.barridoColumnas.setEnabled(false);
        this.pasadas.setEnabled(false);
        this.etiPasadas1.setEnabled(false);
        this.etiPasadas2.setEnabled(false);
       
        }
       
     
    // Carga los valores de la ventana seg�n Tablero
    private void cargarValoresAutomatico() {
        if (t.tipoBarrido == t.B_SEC_FIL)
                this.barridoSecuencial.setSelected(true);

        else if (t.tipoBarrido == t.B_SEC_COL)
                this.barridoSecuencialCol.setSelected(true);

        else if (t.tipoBarrido == t.B_FILAS)
                this.barridoFilas.setSelected(true);

        else if (t.tipoBarrido == t.B_COLUMNAS)
                this.barridoColumnas.setSelected(true);

        if (t.tipoTablero == t.T_HORIZONTAL)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
        else if (t.tipoTablero == t.T_VERTICAL)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
        else if (t.tipoTablero == t.T_CUADRICULA)
        {
                this.barridoSecuencial.setEnabled(true);
                this.barridoSecuencialCol.setEnabled(true);
                this.barridoFilas.setEnabled(true);
                this.barridoColumnas.setEnabled(true);
                this.pasadas.setEnabled(true);
        }
        else if (t.tipoTablero == t.T_SOLOBOTON)
        {
                this.barridoSecuencial.setEnabled(false);
                this.barridoSecuencialCol.setEnabled(false);
                this.barridoFilas.setEnabled(false);
                this.barridoColumnas.setEnabled(false);
                this.pasadas.setEnabled(false);
        }
        this.pasadas.setValue(t.pasadas);
    }
   
   
   
    private void barridoColumnasbarridoFasesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_barridoColumnasbarridoFasesActionPerformed
        if (this.barridoFilas.isSelected() || this.barridoColumnas.isSelected()) {
            this.etiPasadas1.setEnabled(true);
            this.etiPasadas2.setEnabled(true);
            this.pasadas.setEnabled(true);
        } else {
            this.etiPasadas1.setEnabled(false);
            this.etiPasadas2.setEnabled(false);
            this.pasadas.setEnabled(false);
        }
    }//GEN-LAST:event_barridoColumnasbarridoFasesActionPerformed

    private void barridoFilasbarridoFasesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_barridoFilasbarridoFasesActionPerformed
        if (this.barridoFilas.isSelected() || this.barridoColumnas.isSelected()) {
            this.etiPasadas1.setEnabled(true);
            this.etiPasadas2.setEnabled(true);
            this.pasadas.setEnabled(true);
        } else {
            this.etiPasadas1.setEnabled(false);
            this.etiPasadas2.setEnabled(false);
            this.pasadas.setEnabled(false);
        }
    }//GEN-LAST:event_barridoFilasbarridoFasesActionPerformed

    private void barridoSecuencialColbarridoSecuencialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_barridoSecuencialColbarridoSecuencialActionPerformed
        this.etiPasadas1.setEnabled(false);
        this.etiPasadas2.setEnabled(false);
        this.pasadas.setEnabled(false);
    }//GEN-LAST:event_barridoSecuencialColbarridoSecuencialActionPerformed

    private void barridoSecuencialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_barridoSecuencialActionPerformed
        this.etiPasadas1.setEnabled(false);
        this.etiPasadas2.setEnabled(false);
        this.pasadas.setEnabled(false);
    }//GEN-LAST:event_barridoSecuencialActionPerformed
   
    private void jButtonConfBarrActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfBarrActionPerformed
        if (this.jRadioButtonBarrTeclado.isSelected()){
            // Creamos interfaz para barrer
            if (t.ppal.mteclado!=null){
                t.ppal.mteclado.finalizar();
                t.ppal.mteclado=null;
            }
            t.ppal.mteclado=new Teclado(t.ppal,true,0);
            t.ppal.mteclado.crearInterfaz(t.BARRER);
        }
        else  if (this.jRadioButtonBarrRaton.isSelected()){
            // Creamos interfaz para barrer
            if (t.ppal.mclic!=null){
                t.ppal.mclic=null;
            }
            t.ppal.mclic= new Raton(t.ppal,true,t.BARRER);
        }
        else  if (this.jRadioButtonBarrMicrofono.isSelected()){
            if (t.ppal.mmicrofono!=null){
                t.ppal.mmicrofono.finalizarAudio();
            }
            t.ppal.mmicrofono= new Microfono(t.ppal, true,t.BARRER);
            t.ppal.mmicrofono.crearVentana();
        }
       
    }//GEN-LAST:event_jButtonConfBarrActionPerformed
   
    private void jButtonConfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConfActionPerformed
        if (this.jRadioButtonTeclado.isSelected()){
            // Creamos interfaz para seleccionar
            if (t.ppal.mteclado!=null){
                t.ppal.mteclado.finalizar();
                t.ppal.mteclado=null;
            }
           
            t.ppal.mteclado=new Teclado(t.ppal,true,0);
            t.ppal.mteclado.crearInterfaz(t.SELECCIONAR);
        }
        else if (this.jRadioButtonRaton.isSelected()){
            // Creamos interfaz para selecionar
            if (t.ppal.mclic!=null){
                t.ppal.mclic=null;
            }
            t.ppal.mclic= new Raton(t.ppal,true,t.SELECCIONAR);
        }
        else if (this.jRadioButtonMicrofono.isSelected()){
            if (t.ppal.mmicrofono!=null){
                t.ppal.mmicrofono.finalizarAudio();
            }
            t.ppal.mmicrofono= new Microfono(t.ppal, true,t.SELECCIONAR);
            t.ppal.mmicrofono.crearVentana();
        }
           
    }//GEN-LAST:event_jButtonConfActionPerformed
   
    private void jRadioButtonBarrMicrofonoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonBarrMicrofonoStateChanged
        if ((this.jRadioButtonBarrMicrofono.isSelected())){//&& (!this.jRadioButtonMicrofono.isEnabled())){
            // desactivo microfono en la seleccion
            if (this.jRadioButtonBarrMicrofono.isEnabled()){//&&(!this.jRadioButtonManual.isSelected())){
                this.jRadioButtonMicrofono.setEnabled(false);
               
            }
           
            // desactivo los botones de barrido de los otros
           
           
           
            // activo boton del barrido de microfono
           
           
            // activo los de seleccion
            this.jRadioButtonRaton.setEnabled(true);
            this.jRadioButtonTeclado.setEnabled(true);
        }
//        else{
//            this.jRadioButtonMicrofono.setEnabled(true);
//            //this.jButtonConfMicrofono.setEnabled(true);
//        }
    }//GEN-LAST:event_jRadioButtonBarrMicrofonoStateChanged
   
    private void jRadioButtonBarrTecladoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonBarrTecladoStateChanged
        if ((this.jRadioButtonBarrTeclado.isSelected())){//&& (!this.jRadioButtonTeclado.isEnabled())){
            // desactivo teclado en la seleccion
            if (this.jRadioButtonBarrTeclado.isEnabled()){//&&(!this.jRadioButtonManual.isSelected())){
                //this.jRadioButtonTeclado.setEnabled(false);
               
            }
           
           
           
           
            // activo los de seleccion
            this.jRadioButtonMicrofono.setEnabled(true);
            this.jRadioButtonRaton.setEnabled(true);
        }
//        else{
//            this.jRadioButtonTeclado.setEnabled(true);
//            this.jButtonConfTeclado.setEnabled(true);
//        }
    }//GEN-LAST:event_jRadioButtonBarrTecladoStateChanged
   
    private void jRadioButtonBarrRatonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonBarrRatonStateChanged
        if ((this.jRadioButtonBarrRaton.isSelected())){//&& (!this.jRadioButtonRaton.isEnabled())){
            // desactivo raton en la seleccion
            if (this.jRadioButtonBarrRaton.isEnabled()){//&&(!this.jRadioButtonManual.isSelected())){
                this.jRadioButtonRaton.setEnabled(false);
               
            }
           
           
           
           
            // activo los de seleccion
            this.jRadioButtonMicrofono.setEnabled(true);
            this.jRadioButtonTeclado.setEnabled(true);
        }
//        else{
//            this.jRadioButtonRaton.setEnabled(true);
//            //this.jButtonConfRaton.setEnabled(true);
//        }
    }//GEN-LAST:event_jRadioButtonBarrRatonStateChanged
   
    private void aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarActionPerformed
        Seleccion.arrastrando = false;
        t.HabilitarArrastre(false);
        System.out.println("teclas: barrer: " + t.teclaBarrido + " seleccionar: " + t.teclaSeleccion);
        if ((t.teclaSeleccion == t.teclaBarrido)&&(this.jRadioButtonTeclado.isSelected())&&
           (this.jRadioButtonManual.isSelected())&&(this.jRadioButtonBarrTeclado.isSelected())){
               System.out.println("No se puede usar la misma tecla para barrer y seleccionar");
               JOptionPane.showMessageDialog(this,"No se puede usar la misma tecla para barrer y seleccionar" ,
                   ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strAviso"),
                   JOptionPane.ERROR_MESSAGE);
        }
        else{
            // Teclado

            // seleccionar
            if (this.jRadioButtonTeclado.isSelected()){
                if ((this.jRadioButtonManual.isSelected())&&(this.jRadioButtonBarrTeclado.isSelected())){
                    System.out.println("Teclado para seleccionar y barrer con teclas: barrer " + t.teclaBarrido + " seleccionar: " + t.teclaSeleccion);
                    // Teclado para barrer y seleccionar
                    if (t.ppal.mteclado!= null){
                        t.ppal.mteclado.finalizar();
                        t.ppal.mteclado=null;
                        // Creamos una instancia
                        //t.ppal.mteclado=new Teclado(t.ppal,true,0);  
                    }
                    t.ppal.mteclado=new Teclado(t.ppal,true,0);
                    System.out.println("Capturo seleccion: " + t.teclaSeleccion + " barrer: " + t.teclaBarrido);
                    t.ppal.mteclado.lanzarRegister();
                    t.ppal.mteclado.capturar(t.teclaSeleccion);
                    t.ppal.mteclado.capturar(t.teclaBarrido);
                    t.uso_teclado=t.SELEC_BARRER;
                   
                }
                else {
                    System.out.println("Teclado para seleccionar");
                    if (t.ppal.mteclado!= null){
                        t.ppal.mteclado.finalizar();
                        t.ppal.mteclado=null;
                        // Creamos una instancia
                        //t.ppal.mteclado=new Teclado(t.ppal,true,0);  
                    }
                    t.ppal.mteclado=new Teclado(t.ppal,true,0);
                    System.out.println("Capturo: " + t.teclaSeleccion);
                    t.ppal.mteclado.lanzarRegister();
                    t.ppal.mteclado.capturar(t.teclaSeleccion);
                    t.uso_teclado= t.SELECCIONAR;
                }
             }

                // teclado para barrer
                else if ((this.jRadioButtonBarrTeclado.isSelected())&& (this.jRadioButtonManual.isSelected())){
                System.out.println("Teclado para barrer");
                if (t.ppal.mteclado!= null){
                    t.ppal.mteclado.finalizar();
                    t.ppal.mteclado=null;
                    // Creamos una instancia
                    //t.ppal.mteclado=new Teclado(t.ppal,true,0);

                }
                t.ppal.mteclado=new Teclado(t.ppal,true,0);
                t.ppal.mteclado.lanzarRegister();
                t.ppal.mteclado.capturar(t.teclaBarrido);
                t.uso_teclado= t.BARRER;

            } else {
                System.out.println("Teclado no se usa");
                if (t.ppal.mteclado!=null){
                    t.ppal.mteclado.finalizar();
                    t.ppal.mteclado=null;
                }
                t.uso_teclado= t.NO_SE_UTILIZA;
            }



            // Raton
            if (this.jRadioButtonRaton.isSelected()){
                t.uso_raton= t.SELECCIONAR;
                System.out.println("Raton para seleccionar");
                if (t.ppal.manejoclic!=null){
                    t.ppal.manejoclic.finalizar();
                    t.ppal.manejoclic=null;
                }
                t.ppal.manejoclic=new ManejoClic();
                t.ppal.manejoclic.start();

            } else if ((this.jRadioButtonBarrRaton.isSelected())&& (this.jRadioButtonManual.isSelected())){
                t.uso_raton= t.BARRER; 
                System.out.println("Raton para barrer");
                if (t.ppal.manejoclic!=null){
                    t.ppal.manejoclic.finalizar();
                    t.ppal.manejoclic=null;
                }
                t.ppal.manejoclic=new ManejoClic();
                t.ppal.manejoclic.start();

                System.out.println("Despues de seleccionar el 1� elemento");
            } else {
                System.out.println("Raton no se usa");
                 if (t.ppal.manejoclic!=null){
                    t.ppal.manejoclic.finalizar();
                    t.ppal.manejoclic=null;
                }
                t.uso_raton= t.NO_SE_UTILIZA;
            }


            // Microfono
            // seleccionar
            if (this.jRadioButtonMicrofono.isSelected()){
                System.out.println("Microfono para seleccionar");
                if (t.ppal.mmicrofono== null){
                    // Creamos una instancia
                    t.ppal.mmicrofono=new Microfono(t.ppal,true,0);
                }
                t.ppal.mmicrofono.usando=true;
                t.ppal.mmicrofono.captureAudio();
                t.uso_microfono= t.SELECCIONAR;
            }
            // barrer
            else if ((this.jRadioButtonBarrMicrofono.isSelected())&& (this.jRadioButtonManual.isSelected())){
                System.out.println("Microfono para barrer");
                if (t.ppal.mmicrofono== null){
                    // Creamos una instancia
                    t.ppal.mmicrofono=new Microfono(t.ppal,true,1);
                }
                t.ppal.mmicrofono.usando=true;
                t.ppal.mmicrofono.captureAudio();
                t.uso_microfono= t.BARRER;

            }
            // no se usa
            else {
                System.out.println("Microfono no se usa");
                if (t.ppal.mmicrofono!=null){
                    t.ppal.mmicrofono.finalizarAudio();
                    t.ppal.mmicrofono=null;
                }
                t.uso_microfono= t.NO_SE_UTILIZA;
            }

            if (Barrido.barriendo){
                Barrido.pararBarrido();
            }

            // barrido automatico
            if (this.jRadioButtonAutomatico.isSelected()){
                if (this.barridoSecuencial.isSelected())
                    t.tipoBarrido = t.B_SEC_FIL;

                else if (this.barridoSecuencialCol.isSelected())
                    t.tipoBarrido = t.B_SEC_COL;

                else if (this.barridoFilas.isSelected())
                    t.tipoBarrido = t.B_FILAS;

                else if (this.barridoColumnas.isSelected())
                    t.tipoBarrido = t.B_COLUMNAS;

                t.CambiarTitulo(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strTitulo"));
                t.pasadas = (Integer) this.pasadas.getValue();


                Barrido.iniciarBarrido();
                t.barrido=t.AUTOMATICO;
            }
            else if (this.jRadioButtonManual.isSelected()){

                int iter=0;
                // Recolorear todos los botones
                while (iter < t.coleccion.size()){
                    t.coleccion.get(iter).setOpaque(true);
                    t.coleccion.get(iter).setBackground(t.colorBot);
                    iter++;
                }
                // selecciono el primero de la coleccion para saber donde empieza barrido manual
                MovimientoTablero.seleccionar(t.coleccion.get(0));

                if (this.jRadioButtonFilas.isSelected()){
                    t.barrido=t.MANUAL_FILAS;
                }
                else if (this.jRadioButtonColumnas.isSelected()){
                    t.barrido=t.MANUAL_COLUMNAS;
                }
                else {
                    t.barrido=t.MANUAL_FILAS_COLUMNAS;
                    t.seleccionandoFila=true;
                    t.filaBarrida=0;
                    MovimientoTablero.barridoManualPorFilas(t.filaBarrida);
                }
            }

            else t.barrido=t.NINGUNO;
            // Activamos el esc si estamos barriendo
            if (t.barrido!=t.NINGUNO){
                if (t.salir!= null){
                        t.salir.finalizar();
                        t.salir=null;
                }
                t.salir=new SalirESC();
                t.salir.lanzarRegister();
            }
            else{
                if (t.salir!= null){
                        t.salir.finalizar();
                        t.salir=null;
                }
            }
            System.out.println("Barrido es: " + t.barrido);
            this.dispose();
        }
    }//GEN-LAST:event_aceptarActionPerformed
   
    private void jRadioButtonManualStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonManualStateChanged
        if (this.jRadioButtonManual.isSelected()){
            //System.out.println("selecciono");
            habilitarManual();
            anterior=0; //manual
        }
//        else if (!this.jRadioButtonManual.isSelected()){
//            deshabilitarManual();
//        }
    }//GEN-LAST:event_jRadioButtonManualStateChanged
   
    private void jRadioButtonNingunoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonNingunoStateChanged
        if (this.jRadioButtonNinguno.isSelected()){
            if (anterior==0){
                deshabilitarManual();
            }
            if (anterior==0) System.out.println("La anterior fue manual");
            anterior=2;
        }
    }//GEN-LAST:event_jRadioButtonNingunoStateChanged
   
    private void jRadioButtonAutomaticoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonAutomaticoStateChanged
       
        if (this.jRadioButtonAutomatico.isSelected()){
            habilitarAutomatico();
            cargarValoresAutomatico();
            //System.out.println("Evento:" + evt.toString());
            if (anterior==0){
                deshabilitarManual();
            }
            if (anterior==0) System.out.println("La anterior fue manual");
            anterior=1;
        }
        else deshabilitarAutomatico();
    }//GEN-LAST:event_jRadioButtonAutomaticoStateChanged
   
    private void jRadioButtonMicrofonoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonMicrofonoStateChanged
        if (this.jRadioButtonMicrofono.isSelected()){
            // se deshabilitan el resto de botones de seleccion
           
           
            // se activa el boton de microfono
           
            // si esta hab el barrido manual, se desactivara la entrada seleccionada
            if (this.jRadioButtonManual.isSelected()){
                this.jRadioButtonBarrMicrofono.setEnabled(false);
               
               
               
                // se habilitaran el resto
                this.jRadioButtonBarrRaton.setEnabled(true);
                this.jRadioButtonBarrTeclado.setEnabled(true);
                if (this.jRadioButtonBarrTeclado.isSelected()){
                   
                } else if (this.jRadioButtonBarrRaton.isSelected()){
                   
                }
               
            }
        }
//        else{
//            if (this.jRadioButtonManual.isSelected()){
//                this.jRadioButtonBarrMicrofono.setEnabled(true);
//                //this.jButtonConfMicrofono.setEnabled(true);
//            }
//        }
    }//GEN-LAST:event_jRadioButtonMicrofonoStateChanged
   
    private void jRadioButtonTecladoStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonTecladoStateChanged
        if (this.jRadioButtonTeclado.isSelected()){
            // se deshabilitan el resto de botones de seleccion
           
            // se activa el boton de teclado
           
            // si esta hab el barrido manual, se desactivara la entrada seleccionada
            if (this.jRadioButtonManual.isSelected()){
                // ya no se deselecciona el teclado
                //this.jRadioButtonBarrTeclado.setEnabled(false);
               
               
               
                // se habilitaran el resto
                this.jRadioButtonBarrRaton.setEnabled(true);
                this.jRadioButtonBarrMicrofono.setEnabled(true);
                if (this.jRadioButtonBarrMicrofono.isSelected()){
                   
                } else if (this.jRadioButtonBarrRaton.isSelected()){
                   
                }
               
            }
           
           
        }
//    else{
//        if (this.jRadioButtonManual.isSelected()){
//            this.jRadioButtonBarrTeclado.setEnabled(true);
//            //this.jButtonConfTeclado.setEnabled(true);
//        }
//    }
    }//GEN-LAST:event_jRadioButtonTecladoStateChanged
   
    private void jRadioButtonRatonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonRatonStateChanged
        if (this.jRadioButtonRaton.isSelected()){
            // se deshabilitan el resto de botones de seleccion
           
           
            // se activa el boton de raton
           
            // si esta hab el barrido manual, se desactivara la entrada seleccionada
            if (this.jRadioButtonManual.isSelected()){
                this.jRadioButtonBarrRaton.setEnabled(false);
               
               
                // se habilitaran el resto
                this.jRadioButtonBarrTeclado.setEnabled(true);
                this.jRadioButtonBarrMicrofono.setEnabled(true);
                if (this.jRadioButtonBarrMicrofono.isSelected()){
                   
                } else if (this.jRadioButtonBarrTeclado.isSelected()){
                   
                }
               
               
            }
        }
//        else{
//            if (this.jRadioButtonManual.isSelected()){
//                this.jRadioButtonBarrRaton.setEnabled(true);
//                //this.jButtonConfRatonBarr.setEnabled(false);
//
//            }
//        }
    }//GEN-LAST:event_jRadioButtonRatonStateChanged
   
   
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ModoEmpleo(new javax.swing.JFrame(), true).setVisible(true);
            }
        });
    }
    // Adecua el texto de los elementos al idioma elegido
    private void ActualizarIdioma(){   
        this.barridoSecuencial.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strBarridoSecFilas"));
        this.barridoSecuencialCol.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strBarridoSecColumnas"));
        this.barridoFilas.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strBarridoFilas"));
        this.barridoColumnas.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strBarridoColumnas"));
        //this.grupoBarrido.setBorder(javax.swing.BorderFactory.createTitledBorder(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strTiposBarrido")));
        this.etiPasadas2.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strPasadas2"));
        this.etiPasadas1.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strPasadas1"));
        this.cancelar.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strCancelar"));
        this.aceptar.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strAceptar"));
        this.setTitle(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strEntradas"));
        this.jPanelSeleccion.setBorder(javax.swing.BorderFactory.createTitledBorder(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strSeleccion")));
        this.jPanelBarrido.setBorder(javax.swing.BorderFactory.createTitledBorder(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strBarrido")));
        this.jRadioButtonRaton.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strClicRaton"));
        this.jRadioButtonTeclado.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strEnter"));
        this.jRadioButtonMicrofono.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strSonido"));
       
        this.jRadioButtonBarrRaton.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strClicRaton"));
        this.jRadioButtonBarrTeclado.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strEnter"));
        this.jRadioButtonBarrMicrofono.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strSonido"));   
        this.jButtonConf.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strConfigurar"));   
        this.jButtonConfBarr.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strConfigurar"));
        this.jRadioButtonAutomatico.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strAutomatico"));
        this.jRadioButtonManual.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strManual"));
        this.jRadioButtonFilas.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strPorFilas"));
        this.jRadioButtonColumnas.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strPorColumnas"));
        this.jRadioButtonFilCol.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strPorFilCol"));
        this.jLabelEntrada.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strEntrada"));
        this.jRadioButtonNinguno.setText(ResourceBundle.getBundle("idiomas.fich_idiomas",t.Idiomas).getString("strNinguno"));
               
               
               
               
   
    private void deshabilitarManual() {
        System.out.println("desh manual");
        // el seleccionado en barrido, se habilita para seleccion,
        // ya que ya no estamos barriendo manualmente
        if (this.jRadioButtonBarrRaton.isSelected()){
            this.jRadioButtonRaton.setEnabled(true);
           
            System.out.println("Vuelvo a hab raton");
        } else if (this.jRadioButtonBarrTeclado.isSelected()){
            this.jRadioButtonTeclado.setEnabled(true);
           
        } else if (this.jRadioButtonBarrMicrofono.isSelected()){
            this.jRadioButtonMicrofono.setEnabled(true);
           
        }
       
        // se deshabilitaran los botones de barrido manual
        this.jRadioButtonFilas.setEnabled(false);
        this.jRadioButtonColumnas.setEnabled(false);
        this.jRadioButtonFilCol.setEnabled(false);
        this.jLabelEntrada.setEnabled(false);
        this.jButtonConfBarr.setEnabled(false);
       
        this.jRadioButtonBarrMicrofono.setEnabled(false);
       
       
        this.jRadioButtonBarrRaton.setEnabled(false);
       
       
        this.jRadioButtonBarrTeclado.setEnabled(false);
       
       
       
    }
    private void habilitarManual() {
        if (this.jRadioButtonManual.isSelected()){
            boolean habilitar=false;
            // se habilitaran los botones de barrido manual
            this.jRadioButtonFilas.setEnabled(true);
            this.jRadioButtonColumnas.setEnabled(true);
            this.jRadioButtonFilCol.setEnabled(true);
            this.jLabelEntrada.setEnabled(true);
            this.jButtonConfBarr.setEnabled(true);
            // miramos a ver si esta seleccionado alguno
            if (this.jRadioButtonMicrofono.isSelected()){
                this.jRadioButtonBarrMicrofono.setEnabled(false);
                this.jRadioButtonBarrTeclado.setEnabled(true);
                this.jRadioButtonBarrRaton.setEnabled(true);
            } else if (this.jRadioButtonRaton.isSelected()){
                this.jRadioButtonBarrRaton.setEnabled(false);
                this.jRadioButtonBarrTeclado.setEnabled(true);
                this.jRadioButtonBarrMicrofono.setEnabled(true);
            }
            else if (this.jRadioButtonTeclado.isSelected()){
                this.jRadioButtonBarrTeclado.setEnabled(true);
                this.jRadioButtonBarrMicrofono.setEnabled(true);
                this.jRadioButtonBarrRaton.setEnabled(true);
            }
           
           
            // seleccionar una opcion y mirar a ver si no esta seleccionada ya en seleccion
            if ((this.jRadioButtonMicrofono.isSelected())&&(this.jRadioButtonBarrMicrofono.isSelected())){
                // habilito otro
                this.jRadioButtonBarrRaton.setSelected(true);
                this.jRadioButtonBarrRaton.setEnabled(true);
               
               
                // deshabilito el resto de los de barrido
                this.jRadioButtonBarrMicrofono.setEnabled(false);
               
               
                this.jRadioButtonBarrTeclado.setEnabled(true);
               
               
                // deshabilito en seleccion el seleccionado en barrido
                this.jRadioButtonRaton.setEnabled(false);
               
            }
            else if ((this.jRadioButtonTeclado.isSelected())&&(this.jRadioButtonBarrTeclado.isSelected())){
                // habilito otro
                //this.jRadioButtonBarrRaton.setSelected(true);
                this.jRadioButtonBarrRaton.setEnabled(true);
               
               
                // deshabilito el resto de los de barrido
                this.jRadioButtonBarrMicrofono.setEnabled(true);
               
               
                this.jRadioButtonBarrTeclado.setEnabled(true);
               
               
                // deshabilito en seleccion el seleccionado en barrido
                //this.jRadioButtonRaton.setEnabled(false);
               
            }
            else if ((this.jRadioButtonRaton.isSelected())&&(this.jRadioButtonBarrRaton.isSelected())){
                // habilito otro
                this.jRadioButtonBarrTeclado.setSelected(true);
                this.jRadioButtonBarrTeclado.setEnabled(true);
               
               
                // deshabilito el resto de los de barrido
                this.jRadioButtonBarrMicrofono.setEnabled(true);
               
               
                this.jRadioButtonBarrRaton.setEnabled(false);
               
               
                // deshabilito en seleccion el seleccionado en barrido
                this.jRadioButtonTeclado.setEnabled(false);
               
            } else {
                if (this.jRadioButtonBarrMicrofono.isSelected()){
                   
                } else if (this.jRadioButtonBarrTeclado.isSelected()){
                   
                } else if (this.jRadioButtonBarrRaton.isSelected()){
                   
                }
            }
        }
    }

    private void ActualizarInterfaz() {
        // Elegimos el tipo de barrido
        if (t.barrido== t.AUTOMATICO){
            this.habilitarAutomatico();
            this.deshabilitarManual();
            this.jRadioButtonAutomatico.setSelected(true);
        }
        else if (t.barrido== t.NINGUNO){
            this.deshabilitarAutomatico();
            this.deshabilitarManual();
            this.jRadioButtonNinguno.setSelected(true);
        }
        else{ // manual
            habilitarTodoManual();
            deshabilitarAutomatico();
            this.jRadioButtonManual.setSelected(true);
            if ((t.uso_teclado==t.BARRER)||(t.uso_teclado==t.SELEC_BARRER)){
                this.jRadioButtonBarrTeclado.setSelected(true);
                this.jRadioButtonTeclado.setSelected(true);
            }
           
//            // si usamos teclado para barrer y seleccionar
//            else if (t.uso_teclado==t.SELEC_BARRER){
//                this.jRadioButtonBarrTeclado.setSelected(true);
//                this.jRadioButtonTeclado.setSelected(true);
//            }
            else if (t.uso_raton==t.BARRER){
                this.jRadioButtonBarrRaton.setSelected(true);
            }
            else if (t.uso_microfono==t.BARRER){
                this.jRadioButtonBarrMicrofono.setSelected(true);
            }
               
            // tipo de barrido manual   
            if (t.barrido== t.MANUAL_FILAS){
                this.jRadioButtonFilas.setSelected(true);
            }
            else if (t.barrido== t.MANUAL_COLUMNAS){
                this.jRadioButtonColumnas.setSelected(true);
            }
            else if (t.barrido== t.MANUAL_FILAS_COLUMNAS){
                this.jRadioButtonFilCol.setSelected(true);
            }
        }
        // Elegimos la seleccion
        if (t.uso_teclado== t.SELECCIONAR){
            this.jRadioButtonTeclado.setSelected(true);
            if ((t.barrido!=t.AUTOMATICO)&& (t.barrido!= t.NINGUNO)){
                this.jRadioButtonBarrTeclado.setEnabled(true);
            }
        }
        else if (t.uso_teclado== t.SELEC_BARRER){
            this.jRadioButtonTeclado.setSelected(true);
            if ((t.barrido!=t.AUTOMATICO)&& (t.barrido!= t.NINGUNO)){
                this.jRadioButtonBarrTeclado.setEnabled(true);
            }
        }
        else if (t.uso_microfono== t.SELECCIONAR){
            this.jRadioButtonMicrofono.setSelected(true);
             if ((t.barrido!=t.AUTOMATICO)&& (t.barrido!= t.NINGUNO)){
                this.jRadioButtonBarrMicrofono.setEnabled(false);
            }
        }
        else if (t.uso_raton == t.SELECCIONAR){
            this.jRadioButtonRaton.setSelected(true);
             if ((t.barrido!=t.AUTOMATICO)&& (t.barrido!= t.NINGUNO)){
                this.jRadioButtonBarrRaton.setEnabled(false);
            }
        }
       
    }

    private void habilitarTodoManual() {
        this.jRadioButtonBarrMicrofono.setEnabled(true);
        this.jRadioButtonBarrRaton.setEnabled(true);
        this.jRadioButtonBarrTeclado.setEnabled(true);
        this.jButtonConfBarr.setEnabled(true);
        this.jRadioButtonFilas.setEnabled(true);
        this.jRadioButtonColumnas.setEnabled(true);
        this.jRadioButtonFilCol.setEnabled(true);
    }
   
    // Declaraci�n de varibales -no modificar//GEN-BEGIN:variables
    private javax.swing.JButton aceptar;
    private javax.swing.JRadioButton barridoColumnas;
    private javax.swing.JRadioButton barridoFilas;
    private javax.swing.JRadioButton barridoSecuencial;
    private javax.swing.JRadioButton barridoSecuencialCol;
    private javax.swing.ButtonGroup buttonGroupAutomatico;
    private javax.swing.ButtonGroup buttonGroupBarrido;
    private javax.swing.ButtonGroup buttonGroupEntrada;
    private javax.swing.ButtonGroup buttonGroupManual;
    private javax.swing.ButtonGroup buttonGroupSeleccion;
    private javax.swing.JButton cancelar;
    public javax.swing.JLabel etiPasadas1;
    private javax.swing.JLabel etiPasadas2;
    private javax.swing.JButton jButtonConf;
    private javax.swing.JButton jButtonConfBarr;
    private javax.swing.JLabel jLabelEntrada;
    private javax.swing.JPanel jPanelBarrido;
    private javax.swing.JPanel jPanelSeleccion;
    private javax.swing.JRadioButton jRadioButtonAutomatico;
    private javax.swing.JRadioButton jRadioButtonBarrMicrofono;
    private javax.swing.JRadioButton jRadioButtonBarrRaton;
    private javax.swing.JRadioButton jRadioButtonBarrTeclado;
    private javax.swing.JRadioButton jRadioButtonColumnas;
    private javax.swing.JRadioButton jRadioButtonFilCol;
    private javax.swing.JRadioButton jRadioButtonFilas;
    private javax.swing.JRadioButton jRadioButtonManual;
    private javax.swing.JRadioButton jRadioButtonMicrofono;
    private javax.swing.JRadioButton jRadioButtonNinguno;
    private javax.swing.JRadioButton jRadioButtonRaton;
    private javax.swing.JRadioButton jRadioButtonTeclado;
    private javax.swing.JSpinner pasadas;
    // Fin de declaraci�n de variables//GEN-END:variables
   
}
TOP

Related Classes of Interfaz.ModoEmpleo

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.