0

Hi all,
Im starting to program in java with sql.
The problem im having is that when im trying to complete a combo box with data from a table in sql i get this error:
"null error in cargarComboProvincias()" when i run the program, and i cant find the error in the code. :S
id appreciate if any1 helps me with it :D

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;


public class Proveedores extends javax.swing.JFrame
{
    Connection cnn;
    ConexionesBaseDeDatos conexiones = new ConexionesBaseDeDatos();

    
    public Proveedores() {
        initComponents();
    }

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

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtNombreProveedor = new javax.swing.JTextField();
        txtDireccionProveedor = new javax.swing.JTextField();
        txtMailProveedor = new javax.swing.JTextField();
        cmbProvinciasProveedores = new javax.swing.JComboBox();
        btnCrearProveedor = new javax.swing.JButton();
        btnModificarProveedor = new javax.swing.JButton();
        btnDesabilitarProveedor = new javax.swing.JButton();
        txtTelefonoProveedor = new javax.swing.JFormattedTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        listProveedores = new javax.swing.JList();
        btnAceptar = new javax.swing.JButton();
        btnGuardarCambios = new javax.swing.JButton();
        btnDesabilitar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
        });

        jLabel1.setText("Nombre");

        jLabel2.setText("Teléfono");

        jLabel3.setText("Dirección");

        jLabel4.setText("Mail");

        jLabel5.setText("Provincia");

        btnCrearProveedor.setText("Crear Proveedor");

        btnModificarProveedor.setText("Modificar Proveedor");

        btnDesabilitarProveedor.setText("Deshabilitar Proveedor");

        txtTelefonoProveedor.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));

        listProveedores.setEnabled(false);
        listProveedores.setVisibleRowCount(13);
        jScrollPane1.setViewportView(listProveedores);

        btnAceptar.setText("Aceptar");

        btnGuardarCambios.setText("Guardar Cambios");
        btnGuardarCambios.setEnabled(false);

        btnDesabilitar.setText("Desabilitar");
        btnDesabilitar.setEnabled(false);

        btnCancelar.setText("Cancelar");

        jMenu1.setText("File");

        jMenuItem1.setText("Proveedores");
        jMenu1.add(jMenuItem1);

        jMenuItem2.setText("Clientes");
        jMenu1.add(jMenuItem2);

        jMenuItem3.setText("Modelos");
        jMenu1.add(jMenuItem3);

        jMenuItem4.setText("Eventos");
        jMenu1.add(jMenuItem4);

        jMenuItem5.setText("Subastas");
        jMenu1.add(jMenuItem5);

        jMenuItem6.setText("Compras");
        jMenu1.add(jMenuItem6);

        jMenuItem7.setText("Ventas");
        jMenu1.add(jMenuItem7);

        jMenuItem10.setText("Colecciones");
        jMenu1.add(jMenuItem10);

        jMenuItem11.setText("Lineas");
        jMenu1.add(jMenuItem11);

        jMenu3.setText("Productos");

        jMenuItem9.setText("Tipos de productos");
        jMenu3.add(jMenuItem9);

        jMenu1.add(jMenu3);

        jMenu4.setText("Insumos");

        jMenuItem8.setText("Tipos de insumos");
        jMenu4.add(jMenuItem8);

        jMenu1.add(jMenu4);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Ayuda");

        jMenuItem12.setText("Acerca de...");
        jMenu2.add(jMenuItem12);

        jMenuBar1.add(jMenu2);

        jMenu5.setText("Salir");
        jMenuBar1.add(jMenu5);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(btnCrearProveedor)
                .addGap(97, 97, 97)
                .addComponent(btnModificarProveedor)
                .addGap(104, 104, 104)
                .addComponent(btnDesabilitarProveedor)
                .addContainerGap(64, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(67, 67, 67)
                .addComponent(btnAceptar)
                .addGap(52, 52, 52)
                .addComponent(btnCancelar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE)
                .addComponent(btnGuardarCambios)
                .addGap(62, 62, 62)
                .addComponent(btnDesabilitar)
                .addGap(71, 71, 71))
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(cmbProvinciasProveedores, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addGap(18, 18, 18)
                            .addComponent(txtTelefonoProveedor))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addComponent(jLabel4)
                            .addGap(42, 42, 42)
                            .addComponent(txtMailProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3)
                            .addComponent(jLabel1))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtNombreProveedor)
                            .addComponent(txtDireccionProveedor, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 137, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnCrearProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnModificarProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(1, 1, 1)
                        .addComponent(btnDesabilitarProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(txtNombreProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(27, 27, 27)
                                .addComponent(jLabel3))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(22, 22, 22)
                                .addComponent(txtDireccionProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addComponent(jLabel5))
                            .addComponent(cmbProvinciasProveedores, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(txtTelefonoProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(21, 21, 21)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(3, 3, 3)
                                .addComponent(jLabel4))
                            .addComponent(txtMailProveedor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(35, 35, 35))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
                        .addGap(27, 27, 27)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnDesabilitar)
                    .addComponent(btnAceptar)
                    .addComponent(btnCancelar)
                    .addComponent(btnGuardarCambios))
                .addGap(64, 64, 64))
        );

        pack();
    }// </editor-fold>

    private void formWindowActivated(java.awt.event.WindowEvent evt) {
        deshabilitarCampos();
        cargarComboProvincias();
    }

    public static void main() {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Proveedores().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton btnAceptar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnCrearProveedor;
    private javax.swing.JButton btnDesabilitar;
    private javax.swing.JButton btnDesabilitarProveedor;
    private javax.swing.JButton btnGuardarCambios;
    private javax.swing.JButton btnModificarProveedor;
    private javax.swing.JComboBox cmbProvinciasProveedores;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JList listProveedores;
    private javax.swing.JTextField txtDireccionProveedor;
    private javax.swing.JTextField txtMailProveedor;
    private javax.swing.JTextField txtNombreProveedor;
    private javax.swing.JFormattedTextField txtTelefonoProveedor;
    // End of variables declaration


/*
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
 */

    private void deshabilitarCampos()
    {
        txtNombreProveedor.setEnabled(false);
        txtDireccionProveedor.setEnabled(false);
        txtMailProveedor.setEnabled(false);
        btnAceptar.setEnabled(false);
        btnCancelar.setEnabled(false);
        btnDesabilitar.setEnabled(false);
        btnGuardarCambios.setEnabled(false);
        cmbProvinciasProveedores.setEnabled(false);
        listProveedores.setEnabled(false);
    }

    private void habilitarCamposBtnCrearProveedor()
    {
        btnAceptar.setEnabled(true);
        btnCancelar.setEnabled(true);
        cmbProvinciasProveedores.setEnabled(true);
        listProveedores.setEnabled(true);
        txtDireccionProveedor.setEnabled(true);
        txtMailProveedor.setEnabled(true);
        txtNombreProveedor.setEnabled(true);
    }

    private void habilitarCamposBtnModificarProveedor()
    {
        btnAceptar.setEnabled(false);
        btnCancelar.setEnabled(true);
        cmbProvinciasProveedores.setEnabled(true);
        listProveedores.setEnabled(true);
        txtDireccionProveedor.setEnabled(true);
        txtMailProveedor.setEnabled(true);
        txtNombreProveedor.setEnabled(true);
        btnGuardarCambios.setEnabled(true);
        btnDesabilitarProveedor.setEnabled(false);
        btnDesabilitar.setEnabled(false);
        btnCrearProveedor.setEnabled(false);
    }

    private void limpiarCampos()
    {
        cmbProvinciasProveedores.setSelectedIndex(-1);
        txtDireccionProveedor.setText("");
        txtMailProveedor.setText("");
        txtNombreProveedor.setText("");
    }






/*
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
*/
    public void habilitarbtnCrearProveedor()
    {
        btnAceptar.setEnabled(true);
        btnCancelar.setEnabled(true);
        cmbProvinciasProveedores.setEnabled(true);
        txtDireccionProveedor.setEnabled(true);
        txtMailProveedor.setEnabled(true);
        txtNombreProveedor.setEnabled(true);
        txtTelefonoProveedor.setEnabled(true);
    }

    
    private void cargarComboProvincias()
    {
       Statement sql;
       ResultSet datos;
       boolean seguir;
       Provincias provinciaActual;

       try
       {
           sql = cnn.createStatement();
           datos = sql.executeQuery("SELECT * FROM provincias WHERE id_provincia IS NOT NULL");
           seguir = datos.next();

           while (seguir)
           {
               provinciaActual = new Provincias();
               provinciaActual.setId_provincia(datos.getInt("id_provincia"));
               provinciaActual.setNombre_provincia(datos.getString("nombre_provincia"));

               provinciaActual.toString();
               cmbProvinciasProveedores.addItem(provinciaActual);
               seguir = datos.next();
          }
       }
       catch (Exception e)
       {
           JOptionPane.showMessageDialog(null,e.getMessage() + "error en cargarComboProvincias");
       }
    }
}
3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Ezzaral
0

The "null error" (presumably null pointer error) also tells you the exact line number where it happened. Would you like to tell us, or do we have to guess?

0

No, it doesn't give me a line number :S. After closing the window, i get this:
"run:
BUILD SUCCESSFUL (total time: 1 minute 4 seconds)". I put the error as a pop-up window.

0

Either replace this line

JOptionPane.showMessageDialog(null,e.getMessage() + "error en cargarComboProvincias");

with

e.printStackTrace();

or add the stack trace before/after your dialog message.

You are suppressing most of the useful debugging information from the exception.

Edited by Ezzaral: n/a

0

well, i just added that line to the code, and what i get is :

java.lang.NullPointerException
        at dolls.Proveedores.cargarComboProvincias(Proveedores.java:410)
        at dolls.Proveedores.formWindowActivated(Proveedores.java:265)
        at dolls.Proveedores.access$000(Proveedores.java:10)
        at dolls.Proveedores$1.windowActivated(Proveedores.java:65)
        at java.awt.AWTEventMulticaster.windowActivated(AWTEventMulticaster.java:372)
        at java.awt.Window.processWindowEvent(Window.java:1874)
        at javax.swing.JFrame.processWindowEvent(JFrame.java:279)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:889)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:409)
        at java.awt.Component.dispatchEventImpl(Component.java:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.SentEvent.dispatch(SentEvent.java:55)
        at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:183)
        at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:286)
        at java.awt.Component.dispatchEventImpl(Component.java:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.lang.NullPointerException
        at dolls.Proveedores.cargarComboProvincias(Proveedores.java:410)
        at dolls.Proveedores.formWindowActivated(Proveedores.java:265)
        at dolls.Proveedores.access$000(Proveedores.java:10)
        at dolls.Proveedores$1.windowActivated(Proveedores.java:65)
        at java.awt.AWTEventMulticaster.windowActivated(AWTEventMulticaster.java:372)
        at java.awt.Window.processWindowEvent(Window.java:1874)
        at javax.swing.JFrame.processWindowEvent(JFrame.java:279)
        at java.awt.Window.processEvent(Window.java:1820)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:889)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:409)
        at java.awt.Component.dispatchEventImpl(Component.java:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.SentEvent.dispatch(SentEvent.java:55)
        at java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent.dispatch(DefaultKeyboardFocusManager.java:183)
        at java.awt.DefaultKeyboardFocusManager.sendMessage(DefaultKeyboardFocusManager.java:210)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:286)
        at java.awt.Component.dispatchEventImpl(Component.java:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2475)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.SequencedEvent.dispatch(SequencedEvent.java:101)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

those lines are the 410:

sql = cnn.createStatement();

and the 216

private void formWindowActivated(java.awt.event.WindowEvent evt) {
        deshabilitarCampos();
        cargarComboProvincias();
    }

when the procedure is called (cargarComboProvincias();)

Edited by gispe: n/a

1

So now you know that 'cnn' is null. The next step is to figure out why it's null.

Votes + Comments
i love similair answerer, not joke +1
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.