Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT/Swing mixed causes invalid thread access
SWT/Swing mixed causes invalid thread access [message #452567] Tue, 22 March 2005 14:16 Go to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Hi!

I have an application which primarily consists of SWT-widgets. Then I have
one Swing-widget. When an update is done in the Swing-widget, I want to
update something in one of my SWT-widgets as well, but when I try to to that
I get a "invalid thread access" error.

My code looks like this:

swingEditor.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent evt) {
mySWTWidget.setText("blah blah");
}
});

Does anyone have experience with this?

Thanks,
Henrik
Re: SWT/Swing mixed causes invalid thread access [message #452569 is a reply to message #452567] Tue, 22 March 2005 14:55 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The Swing event thread is a different thread the SWT UI thread. Because
of this the swing key listener is notifying from the Swing thread and
you can't make SWT changes from a non-SWT UI thread. You need to use

display.asyncExec(new Runnable() {...}); to allow updating of the SWT
widget.


--
Thanks,
Rich Kulp
Previous Topic:Question about Customizing Combox
Next Topic:dialog box -> view ?
Goto Forum:
  


Current Time: Fri Jul 19 14:12:33 GMT 2019

Powered by FUDForum. Page generated in 0.01903 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top