• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swt threads

 
tarun swoop
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to call the UI-thread, to executed the code.

Have a look at this.

The code will look something like this:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic