Reputation: 59
So I have a ListView that contains Tasks. A Task is composed of a title, description, and urgency, all of which are Strings. What I would like to have happen is that the ListView displays the titles of the tasks it contains. However, I cannot simply switch my ListView to be over Strings, because I need to be able to access the underlying Task object when the task is selected in my GUI. Thus, in my current implementation, the items that appear in the ListView are references to the Task objects (eg, todoList.model.Task@19a4c32f), rather than the title of the Task (eg, "Do Laundry"). Any help in resolving this issue would be greatly appreciated!
Upvotes: 0
Views: 30
Reputation: 11144
Did you have a look at the cellFactory
(or in other words: cell renderer) functionality of the ListView
?
There are plenty of good tutorials out there, like on Oracles site.
But the point is
ListView
Upvotes: 0