Want to Construct a javax.swing.Timer object such that the message �Happy Birthday to you� is displayed on a Text Field once per second
Originally posted by Amol Fuke:
Moni,
You need to write one thread for this.Inside Threads run() method you put the code which display 'Happy birthday'.
Like
if(txtfld.getText().equals(""))
{
txtfld.setText(" H");
}
else if(txtfld.getText().trim().equals("H"))
{
txtfld.setText(" Ha");
}
Dont forget to put
Thread.sleep(milliseconds);
at the end.
Hope this helps you.