palexdev / MaterialFX

A library of material components for JavaFX
GNU Lesser General Public License v3.0
1.21k stars 122 forks source link

Error when add MFXCheckTreeItem into MFXCheckTreeView #312

Closed thucnobita97 closed 1 year ago

thucnobita97 commented 1 year ago

@FXML private MFXCheckTreeView checkTreeView;

MFXCheckTreeItem root = new MFXCheckTreeItem("Restaurants"); root.setExpanded(true); Model.restaurants.forEach(res -> { root.getChildrenUnmodifiable().add(new MFXCheckTreeItem(res.getName())); }); checkTreeView = new MFXCheckTreeView<>(root);

[Error after]: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Children: child node is null: parent = StackPane[id=contentPane]