This is JavaFX tutorial about JavaFX 2 ListView. The ListView class represents a scrollable list of items. Below is a example how our ListView will look in the end of this tutorial. In this tutorial, I am going to create JavaFX 2 ListView and implement OnMouseClicked Event Handler.





It's simple example with just four list items. Also, I wanted here to implement and handle some basic action. As can be seen from the code I create method initActions() , where I detect on which ListView value is the mouse clicked. When user click on ListView, I set text to a label. This is a pretty basic stuff, because our goal isn't to handle some complex actions for this example. It's just important to understand how to handle actions with ListView.

Below is the code of our example:

If you have any comments, questions, and anything like that, please feel free to leave a comment below, or at least if you like this tutorial you can SHARE it with your friends.

-->-->