Probleem avec une JList ....

dinous Messages postés 57 Date d'inscription mercredi 18 décembre 2002 Statut Membre Dernière intervention 21 juin 2006 - 21 mars 2005 à 19:20
super_toinou Messages postés 764 Date d'inscription mardi 25 mai 2004 Statut Membre Dernière intervention 8 mars 2011 - 22 mars 2005 à 15:41
alors voilà ce code marche :

model1 = new DefaultListModel();

String plop = new String("plop");

model1.addElement(plop);

listResult = new JList(model1);

reception.add(listResult);

JScrollPane scroll = new
JScrollPane(listResult);
scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

scroll.setBounds(10, 10, 500, 600);

reception.add(scroll);



mais j'aimerai par exemple que l'orsque je clique sur un bouton ça insert une ligne dans la JList ...



if (e.getSource()==MAJBddLocal)

{

String plop = new String("plop");

model1.addElement(plop);

}



mais ça ne marche pas :'( ( le bouton se déclenche mais rien n'est inséré ....



please help me !!

1 réponse

super_toinou Messages postés 764 Date d'inscription mardi 25 mai 2004 Statut Membre Dernière intervention 8 mars 2011 6
22 mars 2005 à 15:41
repaint, repaintall..... sur ta frame et ca devrai marcher

Toinou
0
Rejoignez-nous