L'exception :Attempt to mutate in notification
salut
je fait du la recherche auto-complétion par une JComboBox
donc j'ai implémenté un evenement KeyListener pour fur à mesure que j'introduit des char à la JComboBox la recherche s'effectue .voila le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| JComboBox cob_rech=new JComboBox();
public void insertUpdate(DocumentEvent e) {
System.out.println("keyPressed2");
String mot =cob_rech.getEditor().getItem().toString();
System.out.println("nom rechercher :"+mot);
int lon =mot.length();
System.out.println("longueur du nom :"+lon);
System.out.println("char :"+mot.charAt(0));
for(int i=0;i<ess.boit.length;i++){
for(int f=0;f<lon;f++){
if(mot.charAt(f)==ess.boit[i][1].charAt(f)){
System.out.println("char match");
}else{
if(existeitem(ess.boit[i][1])==true){
cob_rech.removeItem(ess.boit[i][1]);
cob_rech.showPopup();}
}
}
} |
mais mon pb que j'ai l'exception suivante :
Code:
1 2 3 4
| Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Attempt to mutate in notification
at javax.swing.text.AbstractDocument.writeLock(AbstractDocument.java:1323)
at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:644)
at javax.swing.text.JTextComponent.setText(JTextComponent.java:1693) |