File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access" Watch "Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access" New topic
Author

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

Fictus De la Pjedero
Greenhorn

Joined: Feb 16, 2009
Posts: 5
Hey,

For my application I have created a menu in the system tray. When you click left you get some dynamic data and when you click right on my menu you get a screen to add a new dynamic menuitem to my system tray menu. but when I try to add something to that menu I get this error:

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


this is my code:


When you run this, you see a nice menu in the system tray..
add some text in the screen that popup and click on save.. now you see the error.. (In this example ill trie to change the staic menu into a dynamic one)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Ben,

Please read your private messages.

You might want to check this thread: http://www.coderanch.com/t/430935/Swing-AWT-SWT-JFace/java/Getting-SWTException-Invalid-thread-access


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Fictus De la Pjedero
Greenhorn

Joined: Feb 16, 2009
Posts: 5
Hey,

I've followed your link and I found some example code, but I do not quite understand why it's not working..

Sample code:



If you run this, you will see that "I came here (2nd run)" is not printed..
Can anybody explain why that is and how you can make it run..

(i've tried to implemented it into my code and found out that my menu code is not fired :



So I've come from one proble into another one..

(but I still want to see the first one to be solved: Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access exception)
Fictus De la Pjedero
Greenhorn

Joined: Feb 16, 2009
Posts: 5
Anyone?
 
 
subject: Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access
 
Similar Threads
SWT: Nullpointer Exception when trying to dispose a composite
Swing + SWT
Good design or should I try something else
Shell keeps popping up when creating a menu tray
How to access functions within a thread?