Tuesday, November 16, 2010

Problem with delay setText label java

Programmer Question

Hi,
I have a big problem with a java program.
I try to implement a simple software.
There is a label and i wanna stamp a text in this label but this must be separate by 2 sec.



I have seen a problem with the thread and Swing and I implemented this code but the result not change.
Can you help me please
Thanks



 public void stampChips1(int numberDecrement){

ActionListener taskPerformer = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jLabel1.setText("L'avversario ha deciso di togliere : . ");
}
};
new javax.swing.Timer(2000, taskPerformer).start();


ActionListener taskPerformer2 = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jLabel1.setText("L'avversario ha deciso di togliere : . . ");
}
};
new javax.swing.Timer(2000, taskPerformer2).start();


ActionListener taskPerformer3 = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jLabel1.setText("L'avversario ha deciso di togliere : . . .");
}
};
new javax.swing.Timer(2000, taskPerformer3).start();



jLabel1.setText("L'avversario ha deciso di togliere : " + numberDecrement);
}


Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails