Event scripts run in the foreground. Painting the UI runs in the foreground, so it can't happen until your script finishes. You need to wrap up your long-running operation into a function, and then run that with invokeAsynchronous. That function can send updates back to the foreground with invokeLater.
You must not ever assign to component properties or call component methods from an asynchronous (background) function. You can really scramble Swing and/or deadlock it. Take a look at this thread for a discussion of possibilities:
Naturally, I recommend using the callAsync()
and assignLater()
functions from my later.py
script module.