Hello,
I am trying to just make a simple applet to count slowly from 1-5, pausing in between. However, when i go to run the application, it just pauses to display the application and only shows the last number, not the counting:
any help would be greatly appreciated. (note* i am quite a newb when it comes to java, so explainations would be greatly appreciated!)
thanks in advance,
Jared
I am trying to just make a simple applet to count slowly from 1-5, pausing in between. However, when i go to run the application, it just pauses to display the application and only shows the last number, not the counting:
Code:
import java.awt.*;
import javax.swing.*;
public class SightWords extends JFrame
{
private JPanel mainPanel;
private JTextField mainField;
public SightWords()
{
mainPanel = new JPanel();
mainField = new JTextField("",15);
for (int i=0; i<5; i++)
{
try
{
Thread.sleep (1000);
}
catch ( Exception ex )
{
ex.printStackTrace();
}
mainField.setText(String.valueOf(i));
}
mainPanel.add(mainField);
add(mainPanel);
}
}
any help would be greatly appreciated. (note* i am quite a newb when it comes to java, so explainations would be greatly appreciated!)
thanks in advance,
Jared