CodeProject.TV will close July 31. Remember to ensure you’ve watched or download your videos! Full details here.

Custom List Renderers: Mastering Java Swing Part 65

13m 11s

Cave of Programming

After working as a software developer and contractor for over 14 years for a whole bunch of companies including CSC, Proquest, SPSS and AT&T in the UK and... Read more

How to render your lists just as you want in Java Swing.

You can render the items in a JList control in whatever way you want. Here we look at an example of a custom list renderer. Ours will be pretty simple, but you can put panels or JComponents of an arbitrary degree of fanciness in your lists if you want to. Note: if you want your list to have editable entries, you'll probably want to use a JTable with one column instead.

Custom list renderers
The ListCellRenderer interface
Setting background colors on panels and labels