Java.lang.nullPointerException ao executar método JTextField.setText

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…

O objeto referenciado por infoLivro foi instanciado?

Sim foi instanciado, debuguei o programa e é no momento que vou atualizar o valor no JTextField com o método setText(“123”);

Obrigado.

Achei o meu erro…rs.

Só nao sei porque nao aceita isto.

Crei o atributo
private JTextField dfIsbn;

E no contrutor
dfIsbn = new JTextField(13);

Este código gera nullPointerexception…

Direto como atributo
private JTextField dfTitulo = new JTextField(30);

E no contrutor

dfIsbn.setEnabled(true);
dfIsbn.addActionListener(this);

Ressuscitando o tópico pra não ter dois sobre o mesmo assunto.

Meu setText estava dando o mesmo erro do autor. Corrigi do modo como ele disse (não entendi a diferença, na verdade…) mas o texto continua não aparecendo na interface.

Alguém já passou por coisa parecida? Como resolveu?

Deu certo!

Só tava faltando declarar as variáveis como static!!