Ankur Sharma wrote:Hi I am using a JList to show a number of data in tabular format.
... Can anyone share an idea how to make first row un-selectable(e.g. like a header in JTable).
It seems like a strange thing to want to do, but try this:
You should probably check the ListSelectionModel API to make sure I haven't missed a method.
The other thing you could do is for the first line of your getListCellRendererComponent() method do
if (index == 0) isSelected = false;
That wouldn't change if the top element could be selected or not, but it would be drawn as unselected even when selected, which is almost as good. It's not as clean, but it may suit your needs.