Are you sure you want to add a JPanel to a JList and if so do you mean as an item in the list or as a means of drawing something on the list?
Can you explain exactly what you are you trying to do?
I have a jpanel that shows the score of each player and I want to show this in a jlist so the user can view all the different player scores. Sorry quite new at this
You can't add the JPanel to the JList as by default a JList calls the items toString() method to get the information to display but what you can do is provide your own cell renderer that creates the JPanel layout for each item of information in the JLIst. You would then need to add an object containing the information to place in the JPanel for each player. The JList will pass this object to your cell renderer which can interrogate the object and create an appropriate panel which it passes back to the JList. The JList uses the component passed back to draw the details on the screen.
Bookmarks