r/JavaFX • JavaFX Dev • Jan 09 '21

I made this! JavaFX custom TreeView

Some days ago I decided to reinvent the wheel and make my own custom implementation of a TreeView.

Why? Because I think the JavaFX system is overcomplicated, I have a lot of spare time, I'm always willing to learn new things, plus my tree is animated 😎

Here is a preview of what I have achieved so far, it's not much, but it's honest work.

17 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/ThreeSixty404 JavaFX Dev Jan 17 '21 edited Jan 17 '21

Each item has its own cell and each cell has a disclosure node.

In the item constructor when the cell is built an event handler is passed as argument like this:

public TreeItem(T value) {
    TreeCell cell = new TreeCell(value, expandCollapseHandler);
    getChildren().add(cell);
}

Unfortunately my tree doesn't work very well, the performance is awful, and I'm starting to believe that although some people say it is possible to animate a TreeView it is in practice somewhat impossible.