ok c'est ce que javais fait... alors j'ai un résultat positif, mais un nouveau problème :
voici d'abord mon code :
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 30 31
| /** Handle the key typed event from the text field. */
public void keyTyped(KeyEvent e)
{
String text = txtSoftVersion.getText();
String begin, end="";
int index = 0;
index = text.indexOf("-");
System.out.println("index de - = " + index);
begin = text.substring(0, index);
System.out.println("begin = " + begin);
if(index == 8 && index < text.length())
{
end = text.substring(index+1, text.length());
System.out.println("end = " + end);
}
if(begin.length() == 8 && containsNumber(begin) && end.length() == 4 && containsNumber(end) && index != 0)
{
txtTarLocation.setEnabled(true);
}
else
{
txtTarLocation.setEnabled(false);
}
} |
sauf que apparemment lorsque je fais
String text = txtSoftVersion.getText();
, ça me récupère l'ancienne chaine de caractère !
exemples :
1) txtSoftVersion = 20050920-0008
2) je supprime le "8"
=> la chaine de caractère est "20050920-0008" et non "20050920-000" !!
comment ça se fait??
Partager