I am new to Swings Programming.Iwant to display the contents of JList in the below specified way :
States:
Tamilnadu
Karnataka
AndhraPradesh
Kerala
UttarPradesh
Cities :
Chennai
Hyderabad
Bangalore
Trivendrum
Games :
Cricket
Hockey
Tennis
Billiards
Want to segregate the contents of JList based on Respective catagories.
I have other three Jlists which contains Cities , States and Games separately.
i'm storing them in 3 different JLists only. But while displaying i have to display them in above mentioned manner.
can any one suggest me how to display the lists in specified manner.
Hareendranath Babu Kotha wrote:i'm storing them in 3 different JLists only. But while displaying i have to display them in above mentioned manner.
can any one suggest me how to display the lists in specified manner.
I guess I don't understand how it makes any sense to display them in the above-mentioned manner if you're storing them in 3 different JLists. If you explain this it helps us help you, because it's hard for us to suggest things that don't seem to make any sense.
That said, you should be able to make it look any way you want. What part are you having trouble with?
You should be able to make each list element look any way you want by setting a custom ListCellRenderer. You may also want to set a custom ListSelectionModel to prevent the list elements that serve as category headers from being selected.
Hi
As i said i'm having separate lists , i kept the code which i wrote. even though i'm having separate lists for separate categories i'm seeting them in only model called activeFiltersListModel , with right transfer button i'm adding the selected values from availableFiltersList to activeFiltersList and respective models of lists will be updated.
As i said i want to display the selected values in ActiveFilters Section with the way i specified.
can you please Use Code Tags in the future? It keeps your indentation, and makes it much easier to read code. I've editted your post to include them; can you see the difference?