I need to implement a JList to display the contents of an Array-List. The ArrayList contains "custom" objects, from which I only want to display the title.
A "custom object" can have - title - user etc.
What would be the most efficient way to do this as opposed to what I'm doing now (going through the entire array and building another array of strings with title[i] = customObject.getTitle())?
Thanks to anyone who will take the time to answer...
there no restrictions, bug in the code, for better help sooner post an SSCCE , demonstraded your issue(s)
(don't reinvent the wheel) create a DefaultListModel that hold value for JList
all updates to the ListModel
must be done on Event Dispatch Thread
for most complex output to the GUI or array is based on java.util.List
, Map
, HashMap
, then to use JTable with one column based on AbstractTableModel , because JList
has implemented reduced methods or features in compare with JTable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.