NullPointerException in method!
public void addToWindowTextArea(String tmp)
{
String toAddToList= tmp;
ParentWindow.avbk.ShowInList(toAddToList); // NullPointerException
}
// ParentWindow = Main window
// avbk = childwindow that containes a Textarea
// ShowInList = method to add the text into the textarea
From a search method this method above receives a string. Here is the problem: when I try to send the results to
another method in the child window class the program crash... can someone help?
Thanks!
Try this and look which is null: public void addToWindowTextArea(String tmp){
String toAddToList= tmp;
System.out.println(ParentWindow);
System.out.println(avbk);
ParentWindow.avbk.ShowInList(toAddToList); // NullPointerException
}
Hallo,
you need to solve your nullPointer problem.
As I see it, three objects could be null, ParentWindow, ParentWindow.avbk, or toAddToList. You need to find out which one is null and ensure that it is set correctly. If you are using a development environment with a reasonable debugger, you can set a breakpoint on the offending line, and then use the debugger to inspect the variables.