File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes swt threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "swt threads" Watch "swt threads" New topic

swt threads

tarun swoop

Joined: Jun 22, 2005
Posts: 1
i've migrating from swing to swt and while doing so, got this error.
Exception in thread "Thread-0" org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(
at org.eclipse.swt.SWT.error(
at org.eclipse.swt.SWT.error(
at org.eclipse.swt.widgets.Widget.error(
at org.eclipse.swt.widgets.Widget.checkWidget(
at org.eclipse.swt.widgets.Dialog.checkParent(
at org.eclipse.swt.widgets.Dialog.<init>(
at org.eclipse.swt.widgets.MessageBox.<init>(
at gui.DialogFactory.showError(

all it does is invoke a dialog from a different thread. works fine with swing. what do i do in swt to make it work?
Daniel Eson

Joined: Mar 30, 2002
Posts: 4
You need to call the UI-thread, to executed the code.

Have a look at this.

The code will look something like this:
subject: swt threads
It's not a secret anymore!