Atualizar JList[RESOLVIDO]

0 respostas
L

Olá amigos,

Tenho a seguinte situação, tenho um painel central que monta uma JList com checkboxes, e tenho um botão “avançar proximas opções”, então meu problema é este, como eu monto novamente a JList com as novas opções quando apertar este botão, eu preciso ou tem algum comando para “destruir/desmontar” a JList atual para montar a nova?

Obrigado,

Object[] opcoesResposta = new Object[(xtalk.length)-1];  
preenchaRespostas(xtalk, opcoesResposta);
		
this.pnlCenter = new JPanel(new BorderLayout());
lista=new JList();	
lista.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	    
lista.setCellRenderer(new CheckBoxCellRenderer());
lista.setListData(opcoesResposta); 		 
Font font1 = new Font ("SansSerif", Font.BOLD, 12);
lista.setFont(font1);  
lista.setBackground (Color.blue);
lista.setForeground (Color.green);
		
this.pnlCenter.add(lista);		 
JScrollPane scrollPane = new JScrollPane(lista);
this.pnlCenter.add(scrollPane, BorderLayout.CENTER);
Criado 17 de fevereiro de 2011
Respostas 0
Participantes 1