Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Fictus De la Pjedero
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20526
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Fictus De la Pjedero
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic