Déclaration jTextField3 possible?
Bonjour.
Quelqu'un saurait-il m'indiquer comment résoudre ce problème ?
Merci d'avance pour votre aide.
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
| private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
Thread thread = new Thread(new DelayedWriter(jTextField3, jTextField4.getText()));
thread.start();
}
class DelayedWriter implements Runnable{
JTextField tf;
String s;
public DelayedWriter(JTextField tf, String s){
this.tf = tf;
this.s=s;
}
public void run(){
for (int i=0; i< s.length(); i++)
{
tf.setText(s.substring(0,i+1));
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
Logger.getLogger(sopy.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
} |
image → http://im80.gulfup.com/xlFrFW.png