This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "swt threads" Watch "swt threads" New topic
Author

swt threads

tarun swoop
Greenhorn

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(SWT.java:2691)
at org.eclipse.swt.SWT.error(SWT.java:2616)
at org.eclipse.swt.SWT.error(SWT.java:2587)
at org.eclipse.swt.widgets.Widget.error(Widget.java:381)
at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:284)
at org.eclipse.swt.widgets.Dialog.checkParent(Dialog.java:154)
at org.eclipse.swt.widgets.Dialog.<init>(Dialog.java:116)
at org.eclipse.swt.widgets.MessageBox.<init>(MessageBox.java:81)
at gui.DialogFactory.showError(DialogFactory.java:33)
at threads.DownloadServer.run(DownloadServer.java:22)
at java.lang.Thread.run(Thread.java)

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
Greenhorn

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
 
Similar Threads
org.eclipse.swt.SWTException: Invalid thread access
swt-designer (design view does not work)
Eclipse Closes by itself
Getting "SWTException: Invalid thread access"
Using Eclipse SWT Image, JDBC SQLite and JAVA to insert, store and retrieve Images.