Is there any way I can unfreeze my GUI while a process is running, for example if i run a process which takes 5 minutes, the Jframe will be frozen and unable to press buttons etc.. untill the main process is running. I'll appriciate every bit of help, thank you.
P.S I'm trying to make it unfeeze so a progress bar can work.
Use a background thread such as a SwingWorker here and you'll unfreeze your GUI.
Your problem is that you're running your long process on the Event Dispatch Thread or EDT. This is the single thread that is used by Swing to paint the app and to interact with the user (accept keyboard and mouse input, etc...). When you tie this up you tie up the entire app as Swing can no longer paint or interact. The key is to do long-running processes in the background, but to interact with Swing only via the EDT so you don't put Swing into a dead lock or other bad concurrency situation. The SwingWorker class, part of Java 1.6 was built to try to simplify the solution to this problem by giving you a place for your background processes, a place for this process to publish its results to Swing and a place for it to announce that it is through. I highly recommend you start reading here: Concurrency in Swing