Im trying to make a JDialog that will show the user a dynamic message on a JLabel. The message should be a count from 1 to 10 (and it should be changing a number every secon
make sure jl is defined as final:
...
dia.getContentPane().add(jl);
new Thread(new Runnable() {
for (int i = 0; i < 10; i++) {
try {
Thread.sleep(1000);
jl.setText(text + " " + i);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).run();
dia.setVisible(true);