palexdev / MaterialFX

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

```MFXTreeItem``` Chevron(Arrow icon) doesn't show well when ```setShowRoot(false)``` is set to ```false``` #357

Open infinite-dev22 opened 11 months ago

infinite-dev22 commented 11 months ago

Describe the bug MFXTreeView's MFXTreeItem Chevron(Arrow icon) doesn't show well when MFXTreeView.setShowRoot(false) is set

**[MRE]

public class MREApplication extends Application {
    @Override
    public void start(Stage stage) throws IOException {
        UserAgentBuilder.builder()
                .themes(JavaFXThemes.MODENA)
                .themes(MaterialFXStylesheets.forAssemble(true))
                .setDeploy(true)
                .setResolveAssets(true)
                .build()
                .setGlobal();

        MFXTreeView treeView = new MFXTreeView<>();
        var treeRoot = new MFXTreeItem<>("Root");
        // Branches
        var item = new MFXTreeItem<>("Item");
        var item1 = new MFXTreeItem<>("Item 1");
        var item2 = new MFXTreeItem<>("Item 2");
        var item3 = new MFXTreeItem<>("Item 3");
        var subItem1 = new MFXTreeItem<>("Sub-Item 1");
        var subItem2 = new MFXTreeItem<>("Sub-Item 2");
        var subItem3 = new MFXTreeItem<>("Sub-Item 3");
        // Attach branch nodes
        treeRoot.getItems().addAll(item);
        item.getItems().addAll(item1, item2, item3);
        item2.getItems().addAll(subItem1, subItem2);
        item3.getItems().add(subItem3);
        // Set tree view
        treeView.setShowRoot(false);
        treeView.setRoot(treeRoot);
        treeView.setPadding(new Insets(10));
        // Application root
        HBox root = new HBox(treeView);
        Scene scene = new Scene(root, 320, 240);
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }
}

Screenshots image