I subclassed and reimplemnted the "void done(int)" method which is meant to be the one that closes the dialog, but with no success (it wasn't called at all - maybe something else goes on when the user clicks OK).
Anyway, if there are no other ideas, i guess i'll go with the simple solution.
Bookmarks