Siguiendo con mi proyecto, tengo toda la interface realizada con MVC, pero al pasar de un Jdialog a otro, me sale un error, y no sé que le pasa, no veo errores de sintaxis ni lógicos.
Tengo una ventana de inicio de sesión (JDialog), que logea a la base de datos, y pasa a otra pantalla(que es JFrame), esta pantalla tiene un menú con 7opciones, y al pulsar aceptar en dando en un radioButton, me sale el error:
Código Exception:
Ver original
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at vista.Menu_Ppal.actionPerformed(Menu_Ppal.java:443) 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$000(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.awt.EventQueue$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.awt.EventQueue$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.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)
El Código es muy grande, pero los fragmentos son:
Código Java:
Ver original
@Override // TODO Auto-generated method stub if (e.getSource() == btnAceptar) { if (rdbtnAltaFactura.isSelected()) { miControlador.mostrarVentanaAltaFactura(); } if (rdbtnConsultaDatos.isSelected()) { miControlador.mostrarVentanaConsulta(); //esta es la que pulso } if (rdbtnIntroducirNuevaEmpresa.isSelected()) { miControlador.mostrarVentanaAltaEmpresa(); } if (rdbtnIntroducirNuevoAutonomo.isSelected()) { miControlador.mostrarVentanaIntroNuevoAutonomo(); }
La clase Controlador
Código Java:
Ver original
/** * @return the miMenu_ConsultaFactura */ public Menu_ConsultaFactura getMiMenu_ConsultaFactura() { return miMenu_ConsultaFactura; } /** * @param miMenu_ConsultaFactura the miMenu_ConsultaFactura to set */ public void setMiMenu_ConsultaFactura( Menu_ConsultaFactura miMenu_ConsultaFactura) { this.miMenu_ConsultaFactura = miMenu_ConsultaFactura; } public void mostrarVentanaConsultaFactura() { miMenu_ConsultaFactura.setVisible(true); }
Y esta la clase Consulta. Todas son muy parecidas, por lo que sabiendo arreglar una, arreglo todas. No he incluido el actionPerformed,...
Código Java:
Ver original
/** * */ private static final long serialVersionUID = 1L; "Datos Aut\u00F3nomo"); private Nuevo_controlador miControlador; public Nuevo_controlador getControlador() { return miControlador; } public void setControlador(Nuevo_controlador miControlador) { this.miControlador = miControlador; } /** * Create the application. */ public Menu_Consulta() { this.setTitle("Consulta de Datos"); setBounds(100, 100, 400, 300); { okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); { cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } { panel.setLayout(null); panel_1.setBounds(134, 72, 115, 85); panel.add(panel_1); panel_1.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("97px"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("63px"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("23px"), FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("23px"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); { buttonGroup.add(rdbtnDatosAutonomo); panel_1.add(rdbtnDatosAutonomo, "2, 2, 3, 1, left, top"); } { buttonGroup.add(rdbtnDatosEmpresa); panel_1.add(rdbtnDatosEmpresa, "2, 4, left, top"); } { buttonGroup.add(rdbtnFactura); panel_1.add(rdbtnFactura, "2, 6, left, top"); } } }
Muchas gracias por la ayuda, estoy desesperado y tengo 7 dias para entregarlo,..