Is it possible to have multiple column display in JList ????
Absolutely! You need to make a call to setLayoutOrientation which indicates to the list how it should wrap its data before going to a new row. You can use JList.HORIZONTAL_WRAP or JList.VERITCAL_WRAP. This tells the data to be displayed as usual (as a list) and then wrap when it reaches the bottom.
If you want to combine that call with setVisibleRowCount(-1), you can then display as many items possible in the space that is available.
To compare the two answers by camickr and JasCav:
Here is a wrapped JList of Icon objects:
Here is a JTable with icons in the second row and a special TableCellRenderer:
(Both from my current project.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With