ListCell Animation in ListView

After a long time I am back again with new stuffs. I have seen that JavaFX has got so many demand nowadays. Lots of people are requesting for something new something wow effect. In the same way one of my colleagues told me what if we have listview got some effects on scrolling the list. I got some dig around JavaFX Animation API and did some animation with ListCell but I thought it would be great if I share my works to you guys.

First We got to revamp what is the Listcell. ListCell are designed for making user to display text content in list format. But we can override these and make our own like displaying images,shapes and other controls as well.

ListCell inherits the character of Labeled so in default ListCell only displays the text content.If you want some control in your listcell other than label then there are some bunch of cellfactory in javafx.scene.control.cell package.

Every ListCell are being rendered according to the cellFactory implementation so you are free to implement your own cellFactory to make the listcell even more customizable. I had posted about TableCell customization which utilizes use of cellFactory (TableView Cell Modify)

Lets roll with the ListCell customization.

AnimatedListCell.java

Above Class is subclass of AbstractAnimatedListCell so you can implement this in your cellFactory. Currently AbstractAnimatedListCell is subclass of ListCell which helps to make the animation possible. Now Lets directly move to the animation implementation.

ListViewAnimation.java

Well after implementing those Animation you can get animation instantly on list cell update . However I have added some few styling to make it even more better.

If you want to try out yourself . Grab the source code from here:

 
 


Screenshots of Output:
 


Have a great day πŸ˜‰

3 thoughts on “ListCell Animation in ListView”

  1. Pingback: Java desktop links of the week, September 9 « Jonathan Giles

  2. Pingback: JavaFX links of the week, September 9 // JavaFX News, Demos and Insight // FX Experience

Leave a Reply