Pessoal, é o seguinte, tô criando uma tela de Gerenciamento de Usuários… tudo certo, usei uma JList na horisontal para listar os usuários, colocando uma imagem do usuário e tudo mais… Porém eu precisaria que fosse adicionado dois itens, ou seja o nome e a imagem, usando o addElement com o DefaultListModel ele só deixa colocar um objeto no parâmetro… como fazer para adicionar dois itens?!?
A list uses an object called a cell renderer to display each of its items. The default cell renderer knows how to display strings and icons. If you want to put any other Object in a list or if you want to change the way the default renderer display icons or strings, you can implement a custom cell renderer. Take these steps to provide a custom cell renderer for a list:
We don’t provide an example of a list with a custom cell renderer, but we do have an example of a combo box with a custom renderer — and combo boxes use the same type of renderer as lists. See the example described in Providing a Custom Renderer.
Thiago_G3
valeww kra! Até consegui, porém ele não deixa selecionar o item =/// qq eu faço?!?!