Bonjour,

J'ai la ligne ci-dessous

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
	            if ( text.matches( "[a-zA-Z ] *" ))
Cette ligne n'offre pas n'accepte pas les trait d'union et donc n'accepte pas les prénom comme jean-Michël.

Cette ligne est écrite dans le cadre d'une class Document

Voià la class

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
 static class FileCaseDocument extends PlainDocument
	    {
	        String text = null;
	        String str1, str2;
 
	        @Override
	        public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
	        {
	            if (str == null)
	            {
	                return;
	            }
 
	            text = this.getText(0, this.getLength());
	            str1 = text.substring(0, offs);
	            str2 = text.substring(offs, this.getLength());
 
	            text = str1+str+str2;
 
 
	            if ( text.matches( "[a-zA-Z ] *" ))
	            {
 
		 	          super.insertString(offs, str, a);
	            	}
	        }
	    }
}
Comment accepter les traits 'unions ?

Merci d'avance