Hi im trying to display customer orders that are added to a 'table' class from another class
public class PaymentScreenController {
public ArrayList<Customer> allcustomers; // Defining allcustomers Arraylist
public Table tbl; // Creating instance of Table class
@FXML
public void initialize() {
allcustomers = tbl.getCustomers(); // Error seems to come from here when i assign allcustomers to the getcustomers method of table
System.out.println(tbl.getCustomers());
System.out.println("test");
for (Customer customer : allcustomers) {
System.out.println(customer.getCustomerorder());
}
}
}
any help would be appreciated thanks
** More code*
public void submitorder(ActionEvent actionEvent) throws IOException {
//create a new UNIQUE customer to store that customers menu items
Customer cust = new Customer();
//add items to customer
cust.getCustomerorder().addAll(order);
// Adds the customer order to the table class
tbl.getCustomers().add(cust);
System.out.println(tbl.getCustomers());
//clear menu choices screen
lvOrder.getItems().clear();
// Once added the desired number of customers move to next screen
//extra customer was being added as a customer was put into the ArrayLust after the check happened.
if (tbl.getCustomers().size() == noOfDiners) {
Window mainWindow = btnSubmitOrder.getScene().getWindow();
Parent newRoot = FXMLLoader.load(getClass().getResource("payment_screen.fxml"));
mainWindow.getScene().setRoot(newRoot);
}
}
So the customer adds stuff to their order, and then the customer is added to the table class