I need to make a message dialog with JOptionPane that auto refreshes every second in java, for example a message dialog that display the numbers from the 1 to 100 in 100 seconds, I'm new at programming so I tried it making a cycle like this
import javax.swing.JOptionPane;
public class example{
public static void main(String[] args){
int n = 1;
while(n<=100){
JOptionPane.showMessageDialog(null, n);
n++;
}
}
}
the problem: It makes alot of windows, and doesn't refresh the number, and I need only one message dialog.