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 32 33 34 35 36 37 38
| JLabel tutu = new JLabel("<html><body><form><input type=\"text\" name=\"toto\" value=\"1234\" maxlength=\"5\" size=\"5\"></form></body></html>");
monPanel.add(tutu);
String texte = tutu.getText(),
resultat[][];
int longueurTexte = texte.length(),
ligne = 0;
for(int i=0;i<longueurTexte;i++){
try{
if(texte.charAt(i)+texte.charAt(i+1)
+texte.charAt(i+2)+texte.charAt(i+3)
+texte.charAt(i+4)+texte.charAt(i+5)=="<input")ligne++;
}catch(Exception e){}
}
resultat=new String [ligne][2];
for(int i=0;i<ligne;i++)
for(int j=0;j<2;j++) resultat[i][j]="";
ligne=0;
for(int i=0;i<longueurTexte;i++){
try{
if(texte.charAt(i)+texte.charAt(i+1)
+texte.charAt(i+2)+texte.charAt(i+3)
+texte.charAt(i+4)+texte.charAt(i+5)=="<input"){
int j=i+;
while(texte.charAt(j)!='>') j++;
String input = texte.substring(i,j);
int tailleInput = input.length();
for(int k=tailleInput.toUpperCase().indexOf("NAME=\"");j<tailleInput;k++)
if(tailleInput.charAt(k)!='"') resultat[ligne][0]+=tailleInput.charAt(k);
else j=tailleInput;
for(int k=tailleInput.toUpperCase().indexOf("VALUE=\"");j<tailleInput;k++)
if(tailleInput.charAt(k)!='"') resultat[ligne][1]+=tailleInput.charAt(k);
else j=tailleInput;
ligne++;
}
}catch(Exception e){}
} |
Partager