I am having problems with SWT threads. I have a method that takes long to complete and if its in the event handler it freezes the GUI.

I changed the code so that the event handler runs a thread. I can get the thread to make changes to the GUI. I can get the thread to perform set changes to the GUI. But I cant create a thread that gets info from the GUI. i.e I have a form with many text boxes that facilitate user input. The input must be used when the user presses a button. i.e The user inputs a username and password and then presses the submit button. If I try txtPassword.getText() in my thread then I get this error:

Exception in thread "Thread-0" org.eclipse.swt.SWTException: Invalid thread access

If I hard code the user name and password in my code then it runs perfectly

Please supply me with some simple code snippets of how to get the threads working. A basic way of setting values and a basic way of reading values.

Thanks
Greg