I'm trying to create a simple JavaFX application that switches between 2 screens, one where you can change the variables stored and one that just displays, I have a function defined in the main method that just returns a nullpointerexception when compiling the project in the error log it says its on the line that reads
taskList[i].setTaskName(taskNames[i]);
I tried adding an if statement, similar to the one for the section for the getTechAssigned method, because this variable will be constantly changing, while the taskName variable will be unchanged. I'm just not sure why it's coming up, here's the full code:
variable declarations
Button assignTask, finalizeTask;
FlowPane pane1, pane2;
Scene scene1, scene2;
Stage theStage;
String[] taskNames = {"Notes", "Paging", "Event Mgmt - Early",
"Event Mgmt -Late", "Airhub 2DA", "Airhub 1DA"
"GSSD", "GSSI", "GSSRR", "Publishing",
"Check Holdovers", "Radio", "PTI Walkoff", "Phones
1300"};
task[] taskList = new task[taskNames.length];
GridPane taskGrid = new GridPane();
function that is causing the error:
public void initializeTasks() {
for (int i = 0; i < taskList.length; i++) {
taskList[i].setTaskName(taskNames[i]);
Text t = new Text(taskList[i].getTaskName());
taskGrid.setRowIndex(t, i);
taskGrid.setColumnIndex(t, 0);
if(taskList[i].getTechAssigned() == null) {
taskList[i].setTechAssigned("Not Assigned");
}
Text r = new Text(taskList[i].getTaskName());
taskGrid.setRowIndex(r, i);
taskGrid.setColumnIndex(r, 1);
}
}