Bom dia a Todos !!!
Criei uma classe botao e dentro do metodo seto valores dentro de um campo e quando vai atualzar( setText(‘123’)) ocorre o erro após o código.
public void actionPerformed(ActionEvent e) {
if (“cadastrar”.equals(e.getActionCommand())){
} else if ("excluir".equals(e.getActionCommand())){
} else if ("acervo".equals(e.getActionCommand())){
} else if ("amazon".equals(e.getActionCommand())){
try{
infoLivro.setDfAnoPublica("1");
}catch (Exception ee) {
System.out.println(ee);
}
} else {
}
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at br.senac.sp.visao.InfoLivro.setDfAnoPublica(InfoLivro.java:227)
at br.senac.sp.visao.Botao.actionPerformed(Botao.java:77)
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.AWTEventMulticaster.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.Component.dispatchEvent(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)
Desde já agradeço pela Atenção…