private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { for(int i=0;i<10;i++){ try { Thread.sleep(2000); jTextArea1.setText(String.valueOf(i)); } catch (InterruptedException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } private javax.swing.JTextArea jTextArea1;
After every 2 seconds I need to change the value of jTextArea1. But it shows only the final value which is '9'.