Hello Please help me figure out the problem here. I've looked up it on the StackOverFlow I found some similar questions but not really helped me figure it out.
if(result.isPresent() && result.get() == ButtonType.OK) {
DialogController dialogController = new DialogController();
dialogController.processResult(); //Line 90
System.out.println("Ok was pressed");
}
else {
System.out.println("Cancel was pressed");
}
this piece of code is from my main controller.java class and it refers to a dialog by pressing OK in the dialog it runs DialogController.proccessResult() which is supposed to call the proccessResult and print out the content entered in my dialog textArea and textField: SCREENSHOT OF MY DIALOG
public class DialogController {
@FXML
private TextArea longDescription;
@FXML
private TextField shortDescription;
public void processResult () {
String ld = longDescription.getText().trim(); //Line 24
String sd = shortDescription.getText().trim();
System.Out.PrintLn (ld);
System.Out.PrintLn (sd);
}
}
but it throws a null pointer exception, what seems to be the problem? I'm new to coding though.
Caused by: java.lang.NullPointerException at untitled18/ir.sepich.todolist.DialogController.processResult(DialogController.java:24) at untitled18/ir.sepich.todolist.controller.showItemNewDialog(controller.java:90) ... 54 more