i want to create a little loop where after i press a button on a GUI, a value will change every second; i have tried using a thread but i can't seem to get it working correctly. What now happens is that the program just pauses for 10 seconds after pressing the button. Could you help me?

This is what my code looks like

```
private void ButtonActionPerformed(java.awt.event.ActionEvent evt) { 

for (x = 0; x <= 10; x++)
    {

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
            Thread.currentThread().interrupt(); here.
        }

        nummerlabel.setText(String.valueOf(x));
    }

}

```