Error java.lang.NullPointerException al querer utilizar Jbotton.setEnabled en eclipse
Estoy teniendo inconvenientes con eclipse Mars al querer utilizar el comando .setEnabled(boolean); todo funciona bien hasta que quiero habilitar o des-habilitar un botón.. (solo da error al tratarse de un jbotton, con el jText no da el error)
¿Alguien me puede decir que puede estar pasando?, dejo mi codigo mas abajo.. Gracias :)
JButton btnNuevo = new JButton("Nuevo"); btnNuevo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnEliminar.setEnabled(false); // setEstadoEdicion(true); tDescripcion.setEnabled(true); try { Integer ultimoCodigo = ControladorBD.maximoValorCampo("ciudades", "ciu_codigo"); tCodigo.setText((ultimoCodigo + 1)+ ""); } catch (Exception m1) { // TODO: handle exception } tDescripcion.setRequestFocusEnabled(true); tDescripcion.setText(""); } });
y el error es.
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException At predeterminado.AMBCiudad$8.actionPerformed(AMBCiudad.java:247) At javax. Swing. AbstractButton. FireActionPerformed(Unknown Source) At javax. Swing.AbstractButton$Handler. ActionPerformed(Unknown Source) At javax. Swing. DefaultButtonModel. FireActionPerformed(Unknown Source) At javax. Swing. DefaultButtonModel. SetPressed(Unknown Source) At javax. Swing. Plaf. Basic. BasicButtonListener. MouseReleased(Unknown Source) At java. Awt. Component. ProcessMouseEvent(Unknown Source) At javax. Swing. JComponent. ProcessMouseEvent(Unknown Source) At java. Awt. Component. ProcessEvent(Unknown Source) At java. Awt. Container. ProcessEvent(Unknown Source) At java. Awt. Component. DispatchEventImpl(Unknown Source) At java. Awt. Container. DispatchEventImpl(Unknown Source) At java. Awt. Component. DispatchEvent(Unknown Source) At java. Awt. LightweightDispatcher. RetargetMouseEvent(Unknown Source) At java. Awt. LightweightDispatcher. ProcessMouseEvent(Unknown Source) At java. Awt. LightweightDispatcher. DispatchEvent(Unknown Source) At java. Awt. Container. DispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) At java. Awt. Component. DispatchEvent(Unknown Source) At java. Awt. EventQueue. DispatchEventImpl(Unknown Source) At java. Awt. EventQueue.access$500(Unknown Source) At java. Awt.EventQueue$3. Run(Unknown Source) At java. Awt.EventQueue$3. Run(Unknown Source) At java. Security. AccessController. DoPrivileged(Native Method) At java. Security.ProtectionDomain$JavaSecurityAccessImpl. DoIntersectionPrivilege(Unknown Source) At java. Security.ProtectionDomain$JavaSecurityAccessImpl. DoIntersectionPrivilege(Unknown Source) At java. Awt.EventQueue$4. Run(Unknown Source) At java. Awt.EventQueue$4. Run(Unknown Source) At java. Security. AccessController. DoPrivileged(Native Method) At java. Security.ProtectionDomain$JavaSecurityAccessImpl. DoIntersectionPrivilege(Unknown Source) At java. Awt. EventQueue. DispatchEvent(Unknown Source) At java. Awt. EventDispatchThread. PumpOneEventForFilters(Unknown Source) At java. Awt. EventDispatchThread. PumpEventsForFilter(Unknown Source) At java. Awt. EventDispatchThread. PumpEventsForHierarchy(Unknown Source) At java. Awt. EventDispatchThread. PumpEvents(Unknown Source) At java. Awt. EventDispatchThread. PumpEvents(Unknown Source) At java. Awt. EventDispatchThread. Run(Unknown Source)
1 Respuesta
Respuesta