r/JavaFX • u/ThreeSixty404 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.
1
Jan 17 '21
How did you link the animations with events?
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.
1
3
u/Azzk1kr Jan 09 '21
Have you got some source code or some general hints or advice on how to build your own components in JavaFX?