Skip to main content
gamedev.net
🔒 Locked

[java] JList

Started by dave Dec 19, 2005 at 4:16 PM 1 replies 600+ views
Original Post
dave
dave
How do i have a list box display data in records. Mutliple columns but not of the same datatype. Does anyone know any tutorials? Dave
ViLiO
ViLiO
The swing tutorial has details on JList but nothing really about using more than one data type.

If you aren't needing some sort of combobox style drop-down list then I would suggest you use JTable. It is simple enough to write an event listener for it and it can do many similar things as a jlist.

All the best,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
CaptainJester
CaptainJester
Create a custom Component that can display each row in the format that you want. Then implement the ListCellRender interface to return that component for each row. The use JList.setCellRenderer(...) to make it use your renderer.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.