The gray box you are seeing is because the EDT is blocked and is unable to update the GUI.
You should look into using SwingWorker to perform the long running task on a background thread.
Another option available under Java 7 is SecondaryLoop.
Take a look at Hidden Java 7 Features – SecondaryLoop for a detailed explanation & example.