1

kindly let me know what is wrong with my methods & how to get this done correct.

i have tried to load product details to the table view once the method invoke.

private void initColumn() {
    colPluCode.setCellValueFactory(new PropertyValueFactory<>("prd_id"));
    colPrdDesc.setCellValueFactory(new PropertyValueFactory<>("p_desc"));
    colPrdName.setCellValueFactory(new PropertyValueFactory<>("p_name"));
    colCategory.setCellValueFactory(
            (TableColumn.CellDataFeatures<Products, String> catData) -> new SimpleStringProperty(
                    catData.getValue().getCategory().getCategoryName()));
    colSuppler.setCellValueFactory(
            (TableColumn.CellDataFeatures<Products, String> supData) -> new SimpleStringProperty(
                    supData.getValue().getSupplier().getComName()));
    colPackSize.setCellValueFactory(new PropertyValueFactory<>("pack_size"));
    colPackPrice.setCellValueFactory(new PropertyValueFactory<>("pack_price"));
    colUnitPrice.setCellValueFactory(new PropertyValueFactory<>("unit_price"));
    colUnitCost.setCellValueFactory(new PropertyValueFactory<>("unit_cost_price"));
    colDiscount.setCellValueFactory(new PropertyValueFactory<>("discount"));
    colReorderLevel.setCellValueFactory(new PropertyValueFactory<>("reOrderLevel"));
    colVat.setCellValueFactory(new PropertyValueFactory<>("vat"));
    colOhQty.setCellValueFactory(new PropertyValueFactory<>("onHandQty"));
}

void loadItems() {
    if (productList.isEmpty()) {
        productList.addAll(productModel.getProductList());
    }
    itemTableView.setItems(productList);
}

its gives me following error

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at pharmacySystem.productController.ProductController.lambda$0(ProductController.java:179)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:748)

0 Answers0